Methods
date.isAfter()
Check whether the current date occurs chronologically after another specified date.
The isAfter method evaluates whether the current NepaliDate instance occurs chronologically later than another date or timestamp. It compares exact millisecond values to determine chronological order accurately.
Import
import { NepaliDate } from "nepali-date-library";Signature
isAfter(date: NepaliDate): boolean;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
date | NepaliDate | Yes | Target NepaliDate instance to compare against. |
Return Value
- Type:
boolean - Returns
trueif the current date and time succeeds the provideddatein absolute time; otherwise returnsfalse.
Precision
Comparison is evaluated down to the exact millisecond using the underlying Unix timestamp:
this.timestamp.getTime() > date.timestamp.getTime()Examples
Chronological Comparison
import { NepaliDate } from "nepali-date-library";
const releaseDate = new NepaliDate("2081-05-01");
const currentDate = new NepaliDate("2081-06-10");
console.log(currentDate.isAfter(releaseDate)); // true
console.log(releaseDate.isAfter(currentDate)); // falseChecking Expiration or Deadlines
import { NepaliDate } from "nepali-date-library";
const deadline = new NepaliDate("2081-02-30").endOfDay();
const submission = new NepaliDate();
if (submission.isAfter(deadline)) {
console.log("Submission window has closed.");
}Related
date.isBefore(): Check if a date precedes another.date.isEqual(): Check if calendar dates are identical.date.isSame(): Check equality by specific unit.
Advertisement
date.isBefore()
Check whether the current date occurs chronologically before another specified date.
date.isEqual()
Check whether two date instances share the exact same calendar date coordinates regardless of time.