-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider splitting DateTime into a Date and Time type #309
Comments
In addition to this split, I think we need support for different time zones, and perhaps TZ DB parsing. This way the VM only needs to support producing timestamps in UTC. That in turn would allow us to work around the time-rs crate not supporting local offsets (time-rs/time#293). In short, I want the standard library date/time code to be good enough so we don't need third-party libraries like JodaTime in Java. |
chronotope/chrono#677 chrono should now support parsing timezone files without relying on |
The time-rs dependency is removed as part of https://gitlab.com/inko-lang/inko/-/commit/d07e3543a47c6312fc5883dcd9d138329a2e5aa7, and we now just use the underlying libc/Windows APIs directly. |
Two resources worth looking into: |
The DateTime type is now an inline type built on top of two newly introduced types: std.time.Date and std.time.Time. The Date type stores the date components without a timezone, while the Time type stores the time components, also without a timezone. The UTC offset in turn is stored in the DateTime type. In addition, DateTime.local replaces the old DateTime.new method and DateTime.new is now used to construct a DateTime from a Date, Time and UTC offset. DateTime is _not_ a `copy` type as we may need to store additional non-copy data in the future, such as more detailed timezone related objects. This fixes #309. Changelog: changed
The DateTime type is now an inline type built on top of two newly introduced types: std.time.Date and std.time.Time. The Date type stores the date components without a timezone, while the Time type stores the time components, also without a timezone. The UTC offset in turn is stored in the DateTime type. In addition, DateTime.local replaces the old DateTime.new method and DateTime.new is now used to construct a DateTime from a Date, Time and UTC offset. DateTime is _not_ a `copy` type as we may need to store additional non-copy data in the future, such as more detailed timezone related objects. This fixes #309. Changelog: changed
The type SystemTime, which is being renamed to DateTime as part of https://gitlab.com/inko-lang/inko/-/merge_requests/120, currently stores all its data (years, month, etc) as separate fields. In https://gitlab.com/inko-lang/inko/-/merge_requests/120 I'm also strongly considering removing support for default arguments. This makes constructing a DateTime a bit more tricky when you only want to specify a subset of the data. For example, if you want to create a DateTime for 1980-01-01 00:00:00 you'd have to write this:
Adding all sorts of
static
methods to this type leads to a clunky API. Instead, the following is much nicer:Another benefit is that we now have dedicated date and time types that only operate on a date or time; instead of both.
The text was updated successfully, but these errors were encountered: