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

Fix timezone issues in #attribute_to_time/#to_iso8601_date #961

Merged
merged 2 commits into from Oct 22, 2016

Conversation

Projects
None yet
1 participant
@ddfreyne
Member

ddfreyne commented Oct 22, 2016

Summary

  • Make #attribute_to_time convert Date to UTC (rather than local) Time
  • Make #to_iso8601_date return UTC representation

Detailed description

#to_iso8601_date currently deliberately does not convert to UTC, because the date is supposed to be timezone-agnostic.

For example, if I were to write 2016-10-22, then I intend that specific day, no matter where I am, and what time it is. Converting this date to UTC first could change that date to 2016-10-21 or 2016-10-23, which is not what’s intended.

Unfortunately, this does not hold up when I write a Time (e.g. 2016-10-22 10:15:00) rather than a Date and then run it through #to_iso8601_date.

In order to make both cases work, this PR converts Date to UTC Times rather than local Times, and then makes #to_iso8601_date convert to UTC.

This PR also uncovered an interesting case in the XML sitemap helper (arguably a bug), which is now also fixed.

See also

  • #862 (original fix for this issue)
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Oct 22, 2016

Member

CC @jethrogb — this is the continuation of your PR that you originally opened!

Member

ddfreyne commented Oct 22, 2016

CC @jethrogb — this is the continuation of your PR that you originally opened!

@ddfreyne ddfreyne merged commit 01ddf04 into master Oct 22, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ddfreyne ddfreyne deleted the to-iso-8601-date-utc branch Oct 22, 2016

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