On collaborative projects, like e.g. https://github.com/postmodern/www.ruby-lang.org/, a Jekyll site might be generated by various contributors in different time zones.
In this situation, generated permalinks can alternate between two consecutive days, since the local time zone is used to determine the day of the post date.
The only current solution seems to be calling Jekyll with e.g.
$ TZ=GMT jekyll [options]
I rather would like to have a setting in the _config.yml file. (To prevent the time zone not being set correctly by accident.)
What would your setting look like and what would the acceptable values be? Just "GMT", "UTC", etc, or would "+1100", and "-05:00" work as well? Are you working on a PR? Definitely a good idea.
Any possibility would be fine, e.g. a timezone setting to override the system timezone.
I know nothing about Jekyll internals so I'm currently not working on a pull request.
It seems issue #492 is related to this one.
I'd have a timezone setting which would default to the system timezone if not set explicitly. This timezone setting would be used everywhere any times are handled.
Looks like the tzinfo gem would be a great fit for this.
To clarify the expected behavior:
Let's assume a post has a date set in the YAML front matter:
date: 2013-03-10 23:05:00 UTC
Current behavior when generating permalinks:
since 2013-03-10 23:05:00 UTC is the same as 2013-03-11 00:05:00 +0100 and the day is taken from the representation of the time in the local time zone.
2013-03-10 23:05:00 UTC
2013-03-11 00:05:00 +0100
Expected behavior for timezone = "UTC":
timezone = "UTC"
Furthermore, for a date
date: 2013-03-10 6:00:00 +0900
the permalink with timezone = "UTC" should be ../2013/03/09/... (2013-03-09 21:00:00 UTC).
Personally, I only care about UTC, so even using date.getutc.strftime(...) would do the trick.
I'm not sure about the tzinfo gem, since it seems to actually change the time: if I understand correctly, the returned "local" times are marked as UTC.
That would probably be no issue for generating permalinks, but might be problematic when the full time information (including time zone) is used.
(But I didn't have much time to look into this so I'm not sure.)
@parkr sorry for all the questions but is this also required for v1.0? Would be glad to put this on my list next.
It's in the 1.0 milestone, so we'd like to include it with that release.
@mattr- thanks, I will start taking a look at this tonight.
My PR #957 does this the easy way.
Closed with merge of #957.