ts-utls
Version:
Utilities for TypeScript library
23 lines • 947 B
TypeScript
/**
* @returns {number} the current Unix timestamp in milliseconds
*/
export declare const currentTimestampMillis: () => number;
/**
* Hold thread for the passed time (in milliseconds)
*
* @param {number} ms - The numbe of milliseconds to wait
* @example
* // Sleep for 100 ms
* await sleep(100)
*/
export declare const sleep: (ms: number) => Promise<void>;
/**
* Format a timezone-neutralized date to use in SQL statement for a TIMESTAMP or a DATETIME field, eg.
* `db.query('SELECT * FROM mytable WHERE mytimefield < ?', [toMySQLDateOrEmpty('Apr 8 2022')])`
*
* @param {string} date - The string to use as date
* @param {boolean} withTime - [optional] Set to `true` to include trailing time (defaut: `false`)
* @returns the MySQL-compatible string (or an empty string if the input is not a valid date)
*/
export declare const toMySQLDateOrEmpty: (date: string, withTime?: boolean) => string;
//# sourceMappingURL=time.d.ts.map