Date/Since
1.38.0isAfter
Checks whether the first date occurs after the second date.
isAfter(dateLeft, dateRight):booleanParameters
dateLeftDaterequiredThe date to compare as the first value.
dateRightDaterequiredThe date to compare against.
Returns
booleantrue if dateLeft occurs after dateRight; otherwise, false.
Examples
01
Basic usage
Check whether one date is after another date.
TypeScript
import { isAfter } from "@cyref/js";
const dateLeft = new Date("2026-01-10");
const dateRight = new Date("2026-01-05");
const result = isAfter(dateLeft, dateRight);
console.log(result);
// true02
Date is not after
Returns false when dateLeft occurs before dateRight.
TypeScript
import { isAfter } from "@cyref/js";
const dateLeft = new Date("2026-01-05");
const dateRight = new Date("2026-01-10");
const result = isAfter(dateLeft, dateRight);
console.log(result);
// false03
Equal dates
Equal dates return false because the function checks for a strictly later date.
TypeScript
import { isAfter } from "@cyref/js";
const dateLeft = new Date("2026-03-15T12:00:00");
const dateRight = new Date("2026-03-15T12:00:00");
const result = isAfter(dateLeft, dateRight);
console.log(result);
// false04
Time is included in the comparison
The complete timestamp is compared, including hours, minutes, seconds, and milliseconds.
TypeScript
import { isAfter } from "@cyref/js";
const dateLeft = new Date("2026-06-10T15:30:00");
const dateRight = new Date("2026-06-10T14:30:00");
const result = isAfter(dateLeft, dateRight);
console.log(result);
// true05
Same day, different time
Two dates on the same calendar day can still produce different results based on their time.
TypeScript
import { isAfter } from "@cyref/js";
const morning = new Date("2026-08-20T09:00:00");
const evening = new Date("2026-08-20T18:00:00");
console.log(isAfter(evening, morning));
// true
console.log(isAfter(morning, evening));
// falseBuilt with@cyref/js·Official documentation