Skip to content
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

LocalDate vs time.Time in toml.Unmarshal #787

Closed
bep opened this issue Jun 6, 2022 · 1 comment
Closed

LocalDate vs time.Time in toml.Unmarshal #787

bep opened this issue Jun 6, 2022 · 1 comment

Comments

@bep
Copy link

bep commented Jun 6, 2022

We have had some bug reports in Hugo after the v2 upgrade because of the new local date/datetime types. I probably should have seen these coming and fixed them sooner, as they are fixable on our side. But after doing some work on this (see gohugoio/hugo#9981) I get a nagging feeling that it would possibly be good to have an option or two re. dates in go-toml's Decoder:

  • I notice that it's using time.Local when decoding into a time.Time.
  • When decoding into a map[string]interface{} you currently now always get LocalDateTime/LocalDate.

What would be nice here would be to have Decoder options for

  • the Location to use (time.Local does not work in settings with multiple time zones etc.)
  • also an option to get time.Time when the target is map[string]interface{} (which was the behaviour in v1)

The workaround I'm looking at on the Hugo side now, is to walk the map[string]interface{} and do a conversion, but I have a nagging suspicion that this may be a concern from more people out there.

/cc @jmooring

@bep
Copy link
Author

bep commented Jun 6, 2022

I'm closing this, I need to think a little.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant