UNPKG

warframe-worldstate-data

Version:

Warframe data for use with warframe-worldstate-parser

77 lines 2.93 kB
//#region tools/timeDate.d.ts declare const pieceIsSmoller: (seconds: number, ceiling: number, label: string, timePieces: string[]) => { seconds: number; timePieces: string[]; }; /** * @param {number} millis The number of milliseconds in the time delta * @returns {string} formatted time delta */ declare const timeDeltaToString: (millis: number) => string; /** * Returns the number of milliseconds between now and a given date * @param {Date} d The date from which the current time will be subtracted * @param {function} [now] A function that returns the current UNIX time in milliseconds * @returns {number} The number of milliseconds after the given date to now */ declare const fromNow: (d: Date, now?: () => number) => number; /** * Returns the number of milliseconds between a given date and now * @param {Date} d The date that the current time will be subtracted from * @param {function} [now] A function that returns the current UNIX time in milliseconds * @returns {number} The number of milliseconds after now to the given date */ declare const toNow: (d: Date, now?: () => number) => number; interface ContentTimestamp { $date?: { $numberLong: number | string; }; } interface LegacyTimestamp { sec: number | string; } /** * Returns a new Date constructed from a worldState date object * @param {Object} d The worldState date object * @returns {Date} parsed date from DE date format */ declare const parseDate: (d?: ContentTimestamp | LegacyTimestamp | number) => Date; /** * Get a weekly reset timestamp */ declare const weeklyReset: (nowFunc?: () => Date) => { activation: Date; expiry: Date; }; /** * Get a daily reset timestamp */ declare const dailyReset: (nowFunc?: () => Date) => { activation: Date; expiry: Date; }; /** * An object containing functions to format dates and times * @typedef {Record<string, Function>} TimeDateFunctions * @property {Function} timeDeltaToString - Converts a time difference to a string * @property {Function} fromNow - Returns the number of milliseconds between now and * a given date * @property {Function} toNow - Returns the number of milliseconds between a given * date and now */ declare const _default: { timeDeltaToString: (millis: number) => string; fromNow: (d: Date, now?: () => number) => number; toNow: (d: Date, now?: () => number) => number; parseDate: (d?: ContentTimestamp | LegacyTimestamp | number) => Date; dailyReset: (nowFunc?: () => Date) => { activation: Date; expiry: Date; }; weeklyReset: (nowFunc?: () => Date) => { activation: Date; expiry: Date; }; }; //#endregion export { ContentTimestamp, LegacyTimestamp, dailyReset, _default as default, fromNow, parseDate, pieceIsSmoller, timeDeltaToString, toNow, weeklyReset };