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

“now” date is UTC, not local #332

Open
ticky opened this issue Feb 8, 2019 · 3 comments
Open

“now” date is UTC, not local #332

ticky opened this issue Feb 8, 2019 · 3 comments
Labels
bug Not as expected std-compatibility Jekyll flavor of liquid

Comments

@ticky
Copy link

ticky commented Feb 8, 2019

The “now” keyword, when passed to the date filter in Shopify Liquid calls out to Ruby's Time.now, which returns the current time, in the current system time zone:

$ irb
irb(main):001:0> Time.now
=> 2019-02-08 15:34:25 -0800

liquid-rust’s implementation uses the current time in UTC, which makes templates relying on the upstream Liquid behaviour behave incorrectly!

For instance, my site uses {{ 'now' | date: "%b %-d, %I:%M %P %Z" }} to print the compilation time in the footer of pages, and it is my intent that this shows in the local time zone of the machine that generated it, however, this now emits the date in UTC, which is less desirable to me.


liquid-rust version: master
rust version: 1.32.0
OS: macOS 10.14

@epage epage added bug Not as expected std-compatibility Jekyll flavor of liquid labels Feb 9, 2019
@epage
Copy link
Member

epage commented Feb 9, 2019

It does? Thats disappointing. If you use a CI to build your site, it is unpredictable what time zone it will be in.

Oh, well. The joy of compatibility.

@ticky
Copy link
Author

ticky commented Feb 11, 2019

It’s definitely not a great stance, and I think the suggested workaround is to adjust the time zone of the application (i.e. you could do this by setting TZ, or as Jekyll does, by adjusting it at the build config level), but given that Liquid makes no attempt to allow you to select a time zone for display otherwise, it’d be good to keep it consistent :)

@epage
Copy link
Member

epage commented Feb 11, 2019

Agreed though I think it might be nice to offer a feature flag to change from local to UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not as expected std-compatibility Jekyll flavor of liquid
Projects
None yet
Development

No branches or pull requests

2 participants