Skip to content

isAfterUnix

isAfterUnix(value1: string | number, value2: string | number, options?: { epochUnit?: UnixUnit; }): boolean

Return whether value1 represents an instant strictly after value2.

  • Uses Temporal.Instant.compare to check ordering.
  • Each value is a safe integer or a string of optionally negative ASCII digits; anything else is invalid.
  • Returns false if either input is invalid.
ParameterTypeDescription
value1string | numberfirst unix epoch: a safe integer or a digit string
value2string | numbersecond unix epoch, in the same unit

options

optional: how both epochs are read

OptionTypeDefaultDescription
epochUnit?"seconds" | "milliseconds" | "second" | "millisecond" (UnixUnit)"milliseconds"The unit the epoch values are counted in: "seconds" or "milliseconds", singular or plural. Any other value returns false.

true if value1 is after value2, otherwise false

import { isAfterUnix } from "@northguild/gmt/unix/compare";
isAfterUnix(1706659200, 1704067200) // true
output 

unix/compare/isAfterUnix.ts