chore: update build badge, coverage to 100%, mv DEFAULT_FMT to defaultOptions

This commit is contained in:
Jun Yang
2023-02-23 01:05:54 +08:00
parent 5f4a004e90
commit d4e519c4a6
5 changed files with 17 additions and 4 deletions
+1 -3
View File
@@ -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()
+2
View File
@@ -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,