number primitive which is a valid time value (as used internally in Date instances)
Follows integer/coerce
but returns null
in place of values which go beyond 100 000 0000 days from unix epoch
const coerceToTimeValue = require("type/time-value/coerce");
coerceToTimeValue(12312312); // true
coerceToTimeValue(Number.MAX_SAFE_INTEGER); // false
coerceToTimeValue("foo"); // false
If given argument is a time value coercible value (via time-value/coerce
) returns result number.
Otherwise TypeError
is thrown.
const ensureTimeValue = require("type/time-value/ensure");
ensureTimeValue(12.93); // "12"
ensureTimeValue(Number.MAX_SAFE_INTEGER); // Thrown TypeError: null is not a natural number