Skip to content

areUnixEqual

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

Return whether value1 and value2 represent the same instant.

  • Uses Temporal.Instant.compare to check equality.
  • 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 and value2 are equal, otherwise false

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

unix/compare/areUnixEqual.ts