Releases: FObersteiner/zdt
Releases · FObersteiner/zdt
v0.4.5
v0.4.4
2025-01-05, v0.4.4
Upgrade release, so that zdt build.zig works with the latest 0.14-dev.
Added
- some more tests for Duration formatter
Changed
- build.zig: tzdb generator steps use
b.graph.host
instead ofb.host
(zig 0.13 to 0.14 change)
v0.4.3
2024-11-10, v0.4.3
Added
- Datetime method 'addRelative' to add a RelativeDelta to a Datetime
- ISO duration parser 'W' directive / relative delta type can handle weeks
- Normalizer for the fields of a RelativeDelta (set fields to their "natural" modulo; e.g. hours = [0..23]).
Changed
- ISO duration parser only accepts a minus prefix ('-') to indicate a negative duration. Individual quantities must not be signed.
- Conversion from RelativeDelta to Duration type now a method of RelativeDelta
Fixed
- ISO duration format validation for incorrect order of quantities and position of 'T'
v0.4.2
2024-11-04, v0.4.2
Added
- Duration: ISO8601 duration parser
Changed
- revised examples; type infos now in a separate file 'ex_zdt-types.zig'
Fixed
- formatter of the Duration type, correct output
- datetime parsing / from fields: leap seconds are now validated, i.e. a random datetime cannot have seconds == 60 anymore
v0.4.1
2024-10-28, v0.4.1
Added
- test UTC Timezone can be deinitialized safely
- test UTC offset of a datetime stays untouched if its Timezone gets deinitialized
Changed
- make Timezone.deinit take a pointer to a Timezone instead of a *const (Timezones must be declared as 'var') - by @Ratakor
- (breaking) renamed: 'Timezone.runtimeFromTzfile' to 'Timezone.fromSystemTzdata'
Fixed
- Timezone.UTC can be deinitialized safely now (see Timezone.deinit change) - by @Ratakor
v0.4.0
2024-10-27, v0.4.0
Major change in time zone - related API, see 'Changed' below.
Added
- datetime parser:
- option to use a modifier in parsing directives
- allow parsing of English month/day names, independent of the current locale
- leap seconds:
- method 'validateLeap' to test whether a datetime with seconds == 60 actually is a leap second datetime
- method 'diffLeap' to calculate difference in leap seconds between two datetimes
- offset / time zone handling:
- new type / struct 'UTCoffset', which is used to specify a concrete offset from UTC for a zoned datetime
- new helper union 'tz_options', to provide either a time zone or a UTC offset for functions that set or convert time zones of a datetime
Changed
- (internal) improve Timezone.format method, remove usage of
@constCast
and reduce usage of.?
on optionals - by @Ratakor - (internal) Timezone handling as a tagged union for different sources of rules (IANA db TZif or POSIX; POSIX only prepared, not implemented yet)
- API changes (breaking):
- time zones are generally passed as a pointer to a const
- datetime creation: methods 'fromFields' and 'fromUnix' now take an optional 'tz_options', which is a tagged union that either can be a UTC offset or a Timezone
- time zone set / change: methods 'tzLocalize' and 'tzConvert' also now take 'tz_options'
- 'Datetime.now': also takes 'tz_options' now instead of a Timezone
Removed
- method 'fromTzfile' (Timezone creation). A Timezone should either be created from the embedded tzdata (method 'fromTzdata', comptime or runtime) or at runtime from the system's tzdata (method 'runtimeFromTzfile')
v0.3.5
2024-10-12, v0.3.5
Added
- parser for locale-specific day and month names (Unix)
- (internal) handle parser flags as an enum
Changed
- (internal) clean-up of month/day name functions
2024-10-08, v0.3.4
Added
- leap second difference between two datetimes: method 'diffLeap', returns Duration type
- 'replace' method to safely change fields of a datetime
- 'toFields' method for datetime
Changed
- isocalendar: 'year' field is now called 'isoyear'
- update info on how to update tzdata for development
- (internal) tzdb version info now part of tzdata.zig, since this is specific to the embedded version
Removed
- gen_tzdb_version script; this is now part of the tzdb_update script
v0.3.3
Summary
- re-written parser/formatter (also ISO8601 parser)
- adds directive modifier; extended parsing/formatting directives
- common formats
- ISO calendar methods
Details
2024-10-04, v0.3.3
Added
- ISO-calendar: 'toDatetime' method
- Datetime to string / Formatter:
- 't' directive to get ISO-calendar ("yyyy-Www-d")
- 'Z' directive now has a modifier, which causes UTC to be displayed as 'UTC', not 'Z'
- Datetime from string / Parser:
- 't' directive to get datetime from ISO-calendar
- Formats:
- common formats, see https://pkg.go.dev/time#pkg-constants
- some doc comments regarding 'privacy' of Datetime attributes
Fixed
- ISO Calendar: adjust year from Gregorian to ISO if necessary
- Datetime to string / Formatter:
- 'G' directive / ISO-year
2024-10-03, v0.3.2
Added
- ISO8601 parser:
- '-' as a year-month or month-day separator now optional
- ':' as a hour-minute or minute-second separator now optional
- capability to parse day-of-year (ordinal; 'yyyy-ooo' format)
- Datetime from string / Parser:
- 'j' directive to parse day-of-year
- Datetime to string / Formatter:
- 's' directive to get Unix time in seconds
- ':a', ':A', ':b', ':B' (modifier option) to get English day / month names, independent of locale
Changed
- internal: ISO8601 parser revised
2024-09-30, v0.3.1
Added
- datetime to string
- formatting directive modifier ':', like Rust's chrono strftime has for '%z'
- '%C' formatting directive to get 2-digit century
Changed
- internal: re-write datetime string parser / formatter
- parsing/formatting directives:
- formatting, 'z' gives offset without colon between hour and minute, ':z' gives the usual "+00:00"
- formatting, 'p' gives "am" or "pm", 'P' gives "AM" or "PM"; parser ignores case
- formatting, 'e' and 'k': space-padded day and hour
v0.3.0
2024-09-20, v0.3.0
Added
- method
nowUTC
to Datetime that returns UTC (aware datetime) without needing a timezone argument and returns no error
Changed
- major API revision, mainly string input/output
- Datetime now has
toString
andfromString
, as well asfromISO8601
as a shortcut for ISO8601-compatible input - string.zig and calendar.zig aren't exported anymore (stringIO.zig is now string.zig), to keep the API concise
- Datetime now has
now
returns an error union, in case loading the timezone causes an error
Fixed
toString
: correctly handle naive datetime with 'i', 'z' and 'Z' directives
Removed
- POSIX TZ provisions since this is currently not planned
- method
nowLocal
from Datetime; this can be achieved withnow
plusTimezone.tzLocal
v0.2.3
2024-09-15, v0.2.3
- datetime to string: %I directive, by @sethvincent
- datetime to string, string to datetime: 'am' and 'pm' added, to complement %I
- formatting directives (dt-->str) mostly completed, missing: locale-specific
%c
,%x
and%X
(addresses part of issue #5)
(internal)
- generator script, tz database: checkout specific tag before building the database (addresses part of issue #4)