Generated permalinks depend on system time zone: add configuration setting #850

Closed
stomar opened this Issue Mar 11, 2013 · 13 comments

Projects

None yet

5 participants

Contributor
stomar commented Mar 11, 2013

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.)

Owner
parkr commented Mar 11, 2013

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.

Contributor
stomar commented Mar 11, 2013

Updated

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.

Contributor
stomar commented Mar 12, 2013

It seems issue #492 is related to this one.

Owner
parkr commented Mar 12, 2013

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.

Owner
parkr commented Mar 12, 2013

Looks like the tzinfo gem would be a great fit for this.

Contributor
stomar commented Mar 12, 2013

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:

  • when the site is generated at +0000: .../2013/03/10/...
  • when the site is generated at +0100: .../2013/03/11/...

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.

Expected behavior for timezone = "UTC":

  • independent of the location: ../2013/03/10/.. (day based on the UTC time)

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).

Contributor
stomar commented Mar 12, 2013

Personally, I only care about UTC, so even using date.getutc.strftime(...) would do the trick.

Contributor
stomar commented Mar 12, 2013

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.)

@stomar stomar referenced this issue in ruby/www.ruby-lang.org Mar 14, 2013
Closed

Generated permalinks depend on system time zone #58

Contributor

@parkr sorry for all the questions but is this also required for v1.0? Would be glad to put this on my list next.

Owner
mattr- commented Mar 27, 2013

It's in the 1.0 milestone, so we'd like to include it with that release.

Contributor

@mattr- thanks, I will start taking a look at this tonight.

Owner
parkr commented Apr 14, 2013

My PR #957 does this the easy way.

Owner
parkr commented Apr 15, 2013

Closed with merge of #957.

@parkr parkr closed this Apr 15, 2013
@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.