Methods
date.endOfDay()
Return a new NepaliDate instance set to the final millisecond of the current day.
The endOfDay method returns a new NepaliDate instance with time coordinates set to the final moment of the day at 23 hours, 59 minutes, 59 seconds, and 999 milliseconds. This is commonly used when setting upper boundaries for database queries, event schedules, and daily audit filters.
Import
import { NepaliDate } from "nepali-date-library";Signature
endOfDay(): NepaliDate;Parameters
This method does not take any parameters.
Return Value
- Type:
NepaliDate - Returns a new cloned
NepaliDateinstance set to23:59:59.999on the same calendar day. The original instance is not modified.
Examples
Generating End-of-Day Timestamp
import { NepaliDate } from "nepali-date-library";
const date = new NepaliDate("2081-05-15");
const end = date.endOfDay();
console.log(end.getHours()); // 23
console.log(end.getMinutes()); // 59
console.log(end.getSeconds()); // 59
console.log(end.getMilliseconds()); // 999Inclusive Day Range Filtering
import { NepaliDate } from "nepali-date-library";
// Set upper bound for date filters
const reportDate = new NepaliDate("2081-01-31").endOfDay();
console.log(reportDate.getTime()); // Unix timestamp in millisecondsRelated
date.startOfDay(): Return start of the day (00:00:00.000).date.endOfMonth(): Return final millisecond of the month.date.endOfYear(): Return final millisecond of the year.
Advertisement
date.startOfDay()
Return a new NepaliDate instance set to the first moment of the current day at midnight.
date.startOfWeek()
Return a new NepaliDate instance set to the first day of the week on Sunday.