Closed sebastienros closed 3 months ago
Actually in my local shopify/liquid, it yields an error:
liquid/lib/liquid/standardfilters.rb:681:in `date': wrong number of arguments (given 1, expected 2) (ArgumentError)
But I do think it's better to output something instead of throwing. Now what I can find in JavaScript (with most similarity) is Date.toString()
, what do you think?
> (new Date()).toString()
Thu Dec 22 2022 22:40:58 GMT+0800 (Taipei Standard Time)'
Date.toString()
I find this approach is not feasible for TimezoneDate
. Now I'm trying to set the default format string to '%A, %B %-e, %Y at %-l:%M %P %z'
when it's not provided, so that the use case you provided can pass the test.
It seems OK in this test case: https://github.com/harttle/liquidjs/blob/3f21382d43cafa1e32162e58adabd22d5c3709ed/test/integration/filters/date.ts#L70-L72
The timezone is specified so that this test case can be env independant, more realistic use case is:
Expected:
Actual: https://liquidjs.com/playground.html#e3sgJ25vdycgfCBkYXRlIH19Cnt7ICcyMDIyLTEyLTA3VDIyOjIyOjE4JyB8IGRhdGUgfX0K,e30=