mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-17 21:40:39 -07:00
feat: LiquidOptions.dateFormat to override default date format (#587)
doc: updates related to LiquidOptions.dateFormat doc: revamped the date filter doc for easier reference
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ export function date (this: FilterImpl, v: string | Date, format?: string, timez
|
||||
let date: LiquidDate
|
||||
v = toValue(v)
|
||||
format = toValue(format)
|
||||
if (isNil(format)) format = DEFAULT_FMT
|
||||
if (isNil(format)) format = opts.dateFormat ?? DEFAULT_FMT
|
||||
else format = stringify(format)
|
||||
if (v === 'now' || v === 'today') {
|
||||
date = new Date()
|
||||
|
||||
@@ -38,6 +38,8 @@ export interface LiquidOptions {
|
||||
lenientIf?: boolean;
|
||||
/** JavaScript timezone name or timezoneOffset for `date` filter, default to local time. That means if you're in Australia (UTC+10), it'll default to `-600` or `Australia/Lindeman` */
|
||||
timezoneOffset?: number | string;
|
||||
/** Default date format to use if the date filter doesn't include a format. Defaults to `%A, %B %-e, %Y at %-l:%M %P %z`. */
|
||||
dateFormat?: string;
|
||||
/** Strip blank characters (including ` `, `\t`, and `\r`) from the right of tags (`{% %}`) until `\n` (inclusive). Defaults to `false`. */
|
||||
trimTagRight?: boolean;
|
||||
/** Similar to `trimTagRight`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */
|
||||
|
||||
Reference in New Issue
Block a user