UNPKG

@eluvio/elv-js-helpers

Version:

A collection of Javascript helper functions used by several Eluvio libraries.

29 lines (27 loc) 871 B
'use strict' const now = require('./now') /** * Returns current datetime as a UTC string in ISO 8601 format `YYYY-MM-DDTHH:MM:SSZ` e.g. '2025-01-01T01:00:00Z' * * @function * @category Datetime * @sig () -> String * @returns {String} * @example * * 'use strict' * const nowUTCStr = require('@eluvio/elv-js-helpers/Datetime/nowUTCStr') * * const isGT = require('@eluvio/elv-js-helpers/Boolean/isGT') * const kind = require('@eluvio/elv-js-helpers/Validation/kind') * * const currentUTCTimestamp = nowUTCStr() * * kind(currentUTCTimestamp) //=> 'String' * * // string value is larger (later) than 2025-01-01T01:00:00Z: * isGT('2025-01-01T01:00:00Z', currentUTCTimestamp) //=> true * currentUTCTimestamp.endsWith('Z') //=> true */ const nowUTCStr = () => now().toISOString() module.exports = nowUTCStr