-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
feature request: week number formatting support in strftime
#147
Comments
The I don't think that will change personally. Particularly since I see More generally, full compatibility with other strtime APIs is pretty hard. There's no one featureful spec, and like regex engines, each implementation has their own little quirks and features with little hope for unification. I did of course try to be compatible where I could, but I think given how strtime works (a bunch of overly terse letter modifiers), there's just always going to be points where it doesn't fully line up with other implementations. As far as supporting ISO 8601 week dates in strtime, yes, absolutely, 100% I want to do that. I just didn't do it initially because I wasn't sure about the use case. Given that |
As always, thank you for your considerate and detailed response!
Interesting. This reminds me of old times with PHP, where Java does not use However, Since
That sounds fantastic!
Looking for gaps in
While May I be so bold and try to convince you that for
The next semver-breaking version might move A later (not necessarily semver-breaking) version may then add To my mind, the cost of such a breaking change is still small. At a later point, Of course, I am not in your shoes and this is merely my humble assessment of the situation and the options at hand. Footnotes
|
If I were convinced it was the right way to go, I wouldn't mind doing the breaking change. The fact that it's breaking isn't really what gives me pause. I just think it's better to have IANA time zone identifiers match an existing convention (from
I wouldn't, no. At least, not from any rigorous perspective. There are lots of incompatible strtime APIs out there. I'll think on this. |
Thank you very much for your consideration! |
Given the discussion in #197, I'm leaning towards making a breaking change in So we need to pick a different conversion specific for an IANA time zone identifier. I'm not sure there is much prior art here. I don't think I know of any other |
I think the available choices, for capital letters at least, for a I feel like none of the letter really fit, which means the choices is probably down to compatibility. And if that's not discriminatory (which it appears not), then I guess it's pretty arbitrary. |
And similarly, deprecate `%:V` in favor of `%:Q`. This was regretably done to improve compatibility with other strtime implementations. In particular, `%V` will, in `jiff 0.2`, correspond to an ISO 8601 week number. This matches other `strftime` and `strptime` implementations, such as GNU's. Ref #147
And similarly, deprecate `%:V` in favor of `%:Q`. This was regretably done to improve compatibility with other strtime implementations. In particular, `%V` will, in `jiff 0.2`, correspond to an ISO 8601 week number. This matches other `strftime` and `strptime` implementations, such as GNU's. Ref #147
This adds a whole bunch of conversion specifiers from reading `man strftime` on my system (GNU libc). I originally didn't add most of these because they bloat the size of `BrokenDownTime` and many of them seem a little dubious. But a few folks have filed issues about compatibility. Given the `strtime` API is already a complete clusterfuck, it probably makes sense to just match existing practice as much as we can. One conversion specifier I intend to add but haven't yet is `%V` for the ISO 8601 week number. It is conspicuously absent here since `%V` is currently used for IANA time zone identifiers. That will change in `jiff 0.2`, which will make room for `%V` to be the ISO 8601 week number. Ref #147
This adds a whole bunch of conversion specifiers from reading `man strftime` on my system (GNU libc). I originally didn't add most of these because they bloat the size of `BrokenDownTime` and many of them seem a little dubious. But a few folks have filed issues about compatibility. Given the `strtime` API is already a complete clusterfuck, it probably makes sense to just match existing practice as much as we can. One conversion specifier I intend to add but haven't yet is `%V` for the ISO 8601 week number. It is conspicuously absent here since `%V` is currently used for IANA time zone identifiers. That will change in `jiff 0.2`, which will make room for `%V` to be the ISO 8601 week number. Ref #139, Ref #147
And similarly, deprecate `%:V` in favor of `%:Q`. This was regretably done to improve compatibility with other strtime implementations. In particular, `%V` will, in `jiff 0.2`, correspond to an ISO 8601 week number. This matches other `strftime` and `strptime` implementations, such as GNU's. Ref #147
This adds a whole bunch of conversion specifiers from reading `man strftime` on my system (GNU libc). I originally didn't add most of these because they bloat the size of `BrokenDownTime` and many of them seem a little dubious. But a few folks have filed issues about compatibility. Given the `strtime` API is already a complete clusterfuck, it probably makes sense to just match existing practice as much as we can. One conversion specifier I intend to add but haven't yet is `%V` for the ISO 8601 week number. It is conspicuously absent here since `%V` is currently used for IANA time zone identifiers. That will change in `jiff 0.2`, which will make room for `%V` to be the ISO 8601 week number. Ref #139, Ref #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
This officially drops the deprecated behavior of `%V`, which corresponded to an IANA time zone identifier. This was done to improve compatibility with other `strftime` and `strptime` implementations, such as the one found in GNU libc. Fixes #147
While looking to replace
chrono
withjiff
in code where date formats are passed in from configuration, I realized I could not yet perform the full migration:jiff
does not yet provide formatting of zoned or civil date-time objects as week number in ISO 8601 week date (01–53, zero-padded).chrono
supports this as%V
, among other week number formats (%U
,%W
).chrono::format::strftime
matches GNU coreutilsDATE(1)
(e.g.date +%V
), which is very convenient when modernizing software.Is there any chance
jiff
would ever change its existing%V
(IANA time zone identifier) to a different specifier to allow forcoreutils
andchrono
compatible specifiers?Is the implementation of week number and week year formatting specifiers a feature that might be added to
jiff
?The text was updated successfully, but these errors were encountered: