-
Notifications
You must be signed in to change notification settings - Fork 207
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
Short dates support #63
Comments
I would like to work on this issue. Would it be okay to just extend |
Yes! It probably involves refining the |
Thanks. The changes for the lexer and parser are done. However, these "short" dates/times are defined as "local" dates/times. And it doesn't nicely match with Go's Time, which is more likely DateTime. Does it make sense to have an additional dependency to express them? Apparently there are multiple Date types, which is not great for interoperability though. |
I'm not sure I follow. What's the issue with short dates resulting in |
In the spec, short dates (Local Date-Time and Local Date) are defined as "without any relation to an offset or timezone". Parsing them as Time objects is possible. But doesn't it break round-trip? |
Ha right, I tripped up at "are defined as "local" dates/times". It's a tough one. Time objects would indeed break round-trip. TOML defines those date/time as civil time, so I think we should do the same. My only hesitation is, as you pointed out, there is not a single, or at least very common library to work with those. The option that makes more sense to me is using go/civil. It does not import other dependency, seems easy to use, and makes it trivial for the user to convert to whatever type he fancies. Thoughts? |
The TOML 0.5.0 spec has now extended that definition. Offset Date-TimeTo unambiguously represent a specific instant in time, you may use an odt1 = 1979-05-27T07:32:00Z
odt2 = 1979-05-27T00:32:00-07:00
odt3 = 1979-05-27T00:32:00.999999-07:00 For the sake of readability, you may replace the T delimiter between date and odt4 = 1979-05-27 07:32:00Z The precision of fractional seconds is implementation specific, but at least Local Date-TimeIf you omit the offset from an RFC 3339 ldt1 = 1979-05-27T07:32:00
ldt2 = 1979-05-27T00:32:00.999999 The precision of fractional seconds is implementation specific, but at least Local DateIf you include only the date portion of an ld1 = 1979-05-27 Local TimeIf you include only the time portion of an RFC lt1 = 07:32:00
lt2 = 00:32:00.999999 The precision of fractional seconds is implementation specific, but at least |
Those PRs should fully implement this spec. If anything else is missing please file a bug! |
should all be supported.
The text was updated successfully, but these errors were encountered: