Nepali DateNepali DateBikram Sambat Date Engine
Methods

date.endOfYear()

Return a new NepaliDate instance set to the final day of the Bikram Sambat year on the last day of Chaitra.

The endOfYear method returns a new NepaliDate instance set to the closing day of the current Bikram Sambat calendar year. This corresponds to the final day of Chaitra, which is commonly needed for annual reconciliations and fiscal year preparations.


Import

import { NepaliDate } from "nepali-date-library";

Signature

endOfYear(): NepaliDate;

Parameters

This method does not take any parameters.


Return Value

  • Type: NepaliDate
  • Returns a new NepaliDate set to the last day of Chaitra for the given year at 23:59:59.999. The original instance is not modified.

Examples

Getting the Final Day of the Calendar Year

import { NepaliDate } from "nepali-date-library";

const date = new NepaliDate("2081-03-15");

const yearEnd = date.endOfYear();
console.log(yearEnd.format("YYYY-MM-DD")); // "2081-12-30"
console.log(yearEnd.getMonth()); // 11 (Chaitra)
console.log(yearEnd.getHours()); // 23
console.log(yearEnd.getMinutes()); // 59
console.log(yearEnd.getSeconds()); // 59

Full Calendar Year Span

import { NepaliDate } from "nepali-date-library";

const year = 2081;
const start = new NepaliDate(year, 0, 1).startOfDay();
const end = new NepaliDate(year, 0, 1).endOfYear();

console.log(`Year ${year} spans from ${start.format("YYYY-MM-DD")} to ${end.format("YYYY-MM-DD")}`);

Advertisement

On this page