UNPKG

@walletpass/pass-js

Version:

Apple Wallet Pass generating and pushing updates from Node.js

30 lines 1.21 kB
/** * Checks if given string is a valid W3C date representation * * @param {string} dateStr * @returns {boolean} */ export declare function isValidW3CDateString(dateStr: string): boolean; /** * Converts given string or Date instance into valid W3C date string * * @param {string | Date} value * @throws if given string can't be converted into w3C date * @returns {string} */ export declare function getW3CDateString(value: string | Date): string; /** * Recursively walks a plain-object tree (arrays, objects, primitives) and * replaces every `Date` with `getW3CDateString(date)`. Returns a new tree; * the input is not mutated. Non-plain values (class instances other than * `Date`, functions, symbols) pass through unchanged. * * Use this instead of trusting `JSON.stringify` for any object containing * a pass field that may carry `Date` values. The default * `Date.prototype.toJSON` emits ISO 8601 with milliseconds and trailing * `Z`, which diverges from the W3C format Apple expects in pkpass * `pass.json` entries. */ export declare function normalizeDatesDeep<T>(value: T): T; export declare function getDateFromW3CString(value: string): Date; //# sourceMappingURL=w3cdate.d.ts.map