mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 20:30:39 -07:00
chore: update build badge, coverage to 100%, mv DEFAULT_FMT to defaultOptions
This commit is contained in:
+1
-3
@@ -1,14 +1,12 @@
|
||||
import { toValue, stringify, isString, isNumber, TimezoneDate, LiquidDate, strftime, isNil } from '../util'
|
||||
import { FilterImpl } from '../template'
|
||||
|
||||
const DEFAULT_FMT = '%A, %B %-e, %Y at %-l:%M %P %z'
|
||||
|
||||
export function date (this: FilterImpl, v: string | Date, format?: string, timezoneOffset?: number | string) {
|
||||
const opts = this.context.opts
|
||||
let date: LiquidDate
|
||||
v = toValue(v)
|
||||
format = toValue(format)
|
||||
if (isNil(format)) format = opts.dateFormat ?? DEFAULT_FMT
|
||||
if (isNil(format)) format = opts.dateFormat
|
||||
else format = stringify(format)
|
||||
if (v === 'now' || v === 'today') {
|
||||
date = new Date()
|
||||
|
||||
@@ -120,6 +120,7 @@ export interface NormalizedFullOptions extends NormalizedOptions {
|
||||
strictVariables: boolean;
|
||||
ownPropertyOnly: boolean;
|
||||
lenientIf: boolean;
|
||||
dateFormat: string;
|
||||
trimTagRight: boolean;
|
||||
trimTagLeft: boolean;
|
||||
trimOutputRight: boolean;
|
||||
@@ -146,6 +147,7 @@ export const defaultOptions: NormalizedFullOptions = {
|
||||
fs: fs,
|
||||
dynamicPartials: true,
|
||||
jsTruthy: false,
|
||||
dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z',
|
||||
trimTagRight: false,
|
||||
trimTagLeft: false,
|
||||
trimOutputRight: false,
|
||||
|
||||
Reference in New Issue
Block a user