date-fns-jalali
Version:
Modern JavaScript date utility library for jalali calendar
36 lines (33 loc) • 1.02 kB
JavaScript
import { getMonth as coreGetMonth } from "./_core/getMonth.mjs";
import { getDate as coreGetDate } from "./_core/getDate.mjs";
import { getFullYear as coreGetFullYear } from "./_core/getFullYear.mjs";
import { setFullYear as coreSetFullYear } from "./_core/setFullYear.mjs";
import { newDate as coreNewDate } from "./_core/newDate.mjs";
/**
* @name startOfTomorrow
* @category Day Helpers
* @summary Return the start of tomorrow.
* @pure false
*
* @description
* Return the start of tomorrow.
*
* @returns The start of tomorrow
*
* @example
* // If today is 6 October 2014:
* const result = startOfTomorrow()
* //=> Tue Oct 7 2014 00:00:00
*/
export function startOfTomorrow() {
const now = coreNewDate();
const year = coreGetFullYear(now);
const month = coreGetMonth(now);
const day = coreGetDate(now);
const date = coreNewDate(0);
coreSetFullYear(date, year, month, day + 1);
date.setHours(0, 0, 0, 0);
return date;
}
// Fallback for modularized imports:
export default startOfTomorrow;