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

Date parsing does not conform to all valid RFC3339 forms #5340

raehik opened this Issue Oct 21, 2018 · 3 comments


None yet
3 participants

raehik commented Oct 21, 2018

I insert dates in my content files using a Vim shortcut, which formats them like this:

date: 2006-01-02T15:04:05-0700

Note the omitted colon : between the hours and minutes in the timezone. RFC 3339 pg.13 provides a grammar for valid RFC 3339 datetimes, and the colon is optional.

However, Hugo is unable to parse these dates, and sets them all to 0000-00-00. Adding the colon in makes Hugo parse them as normal. I've done some reading on datetimes in Go and have found that they're awkward and weird. But I don't yet understand where or how Hugo parses dates -- I'd love to help solve this problem if someone could get me started.

(I understand that half my problem is input. Vim uses strftime, which only supports %z -> ±hhmm. date -Iseconds (RFC3339) from coreutils uses ±hh:mm, and provides %:z -> ±hh:mm. But strftime isn't as smart, and having to call a shell function makes it non-portable :( )


This comment has been minimized.


moorereason commented Oct 21, 2018

Please post a companion issue upstream at cast.StringToDate needs another format added to cover that case.


This comment has been minimized.

raehik commented Oct 21, 2018

Thanks, I see how parsing works now. Will make an issue there.


This comment has been minimized.

raehik commented Oct 21, 2018

Upstream has been merged with new tests passing. Quick Hugo build using cast's master branch shows that it reads this new format just fine. Need to update cast version and then good to close :)

Troubleshooting dependencies & building was surprisingly easy for a first-time go getter! And thanks for this project, love how data-oriented Hugo is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment