Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 2x 2x 12x | import { DurationInput } from './types';
import { toMilliseconds } from './toUnit';
/**
* Returns `true` if a duration is negative overall.
*
* Note, this function performs implicit normalization, so ambiguous
* units, like months, work with average values.
*
* @example
* isNegative('P-1D') // true
* isNegative({ days: 1, hours: -25 }) // true
* isNegative({ days: 1, hours: -23 }) // false
*/
export const isNegative = (duration: DurationInput): boolean =>
toMilliseconds(duration) < 0;
|