Coder Social home page Coder Social logo

Comments (2)

quinnj avatar quinnj commented on July 18, 2024

I think I had a stroke of inspiration of sorts last night (coincidentally in the middle of studying for a final...). I think what I'd like to try out is converting DateTime to a fixed millisecond precision (thus removing the Instant parameter) and make the Calendar parameter implicit as well, similar to how Date is fixed at day precision with ISOCalendar. This drastically simplifies the DateTime code for 90% of use cases out there (I'm assuming).

To not lose the extensibility by being fully parameterized though, I'd like to introduce the Timestamp{I<:Instant,T<:Timezone,C<:Calendar} type, which would be used for anything requiring extensibility (other Calendar types, Timezone support, different precision levels, etc.). This way we have nice clean, simple code that would be default and Timestamp for more advanced uses.

Additional advantages of this approach are the fact that the DateTime code was pretty rigidly coded for millisecond precision anyway, and not really generalizable. A fully parameterized Timestamp type can be written with the write abstractions so that someone just needs to define a few methods and be on there way with a different precision level or calendar type. I think this will also be great because we can separate Timezone support out and have custom operation support without having to muck up all the current clean Date/DateTime clode.

from dates.jl.

quinnj avatar quinnj commented on July 18, 2024

Closing for now.

from dates.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.