Nepali DateNepali DateBikram Sambat Date Engine
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

ParameterTypeRequiredDescription
dateNepaliDateYesTarget NepaliDate instance to compare against.

Return Value

  • Type: boolean
  • Returns true if the current date and time succeeds the provided date in absolute time; otherwise returns false.

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)); // false

Checking 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.");
}

Advertisement

On this page