Skip to content

Error when using Date timezoneOffset in 9.28.5 #431

Closed
@pdehaan

Description

@pdehaan

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' }}/"
---

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions