Skip to content

Error when using Date timezoneOffset in 9.28.5 #431

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

Closed
pdehaan opened this issue Dec 3, 2021 · 2 comments
Closed

Error when using Date timezoneOffset in 9.28.5 #431

pdehaan opened this issue Dec 3, 2021 · 2 comments

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Dec 3, 2021

Was trying to verify #375 in Eleventy 1.0.0 beta and ran into a little roadblock (which is probably entirely my fault/misunderstanding).

const { Liquid } = require('liquidjs'); // 9.28.5, per RunKit
const engine = new Liquid({
  timezoneOffset: 0,
  preserveTimezones: true
});
const tpl = engine.parse('Welcome to {{ now | date: "%Y-%m-%d" }}!');
engine.render(tpl, {now: new Date("2019/02/01") })
    .then(console.log);

This works if I comment out timezoneOffset config, but once I try enabling that, I get the following error:

Error: Cannot create property 'timezoneOffset' on string 'Thu Dec 02 2021 18:18:55 GMT-0800 (Pacific Standard Time)


This seems to be the same error I get w/ Eleventy 1.0.0-beta.8 (w/ [email protected]) with the following config:

  eleventyConfig.setLiquidOptions({
    dynamicPartials: false,
    strictFilters: false, // renamed from `strict_filters` in Eleventy 1.0
    // preserveTimezones: true,
    timezoneOffset: 0,
  });

… and this front matter:

---
title: Date Permalink
permalink: "/{{ page.date | date: '%Y/%m/%d' }}/"
---
@pdehaan
Copy link
Contributor Author

pdehaan commented Dec 4, 2021

@harttle harttle added the bug label Dec 7, 2021
@harttle harttle closed this as completed in e2ef236 Dec 7, 2021
github-actions bot pushed a commit that referenced this issue Dec 7, 2021
## [9.28.6](v9.28.5...v9.28.6) (2021-12-07)

### Bug Fixes

* size filter does not respect Objects, fixes [#385](#385) ([6c11426](6c11426))
* throws when using `preserveTimezones` on Node.js, fixes [#431](#431) ([e2ef236](e2ef236))
@github-actions
Copy link

github-actions bot commented Dec 7, 2021

🎉 This issue has been resolved in version 9.28.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants