@jdsalasc/solvejs-date
v1.8.0
Published
UTC-safe TypeScript date utilities for strict parsing, formatting, calendar math, business days, timestamps, and deadline logic without dependencies.
Maintainers
Readme
@jdsalasc/solvejs-date
Zero-dependency date utilities for JavaScript and TypeScript.
Utilities
formatDate,toIsoDateparseDateStrict,parseIsoDate,parseUnixTimestampaddDays,addBusinessDays,diffInDaysstartOfDay,endOfDayisBusinessDay,isWeekend,isLeapYear,daysInMonth
When to use this package
Use it when you need predictable date parsing/formatting, UTC-safe operations, weekend-aware business-day math, and common date helpers without adding heavy dependencies.
Limitations and Constraints
- Formatting tokens are intentionally limited to a small practical set.
- Helpers operate in UTC-safe mode and avoid locale-calendar formatting features.
- For advanced timezone rules per region, integrate a dedicated timezone library.
Install
npm i @jdsalasc/solvejs-dateQuick example
import { parseDateStrict, addBusinessDays, toIsoDate } from "@jdsalasc/solvejs-date";
const d = parseDateStrict("2026-02-07", "YYYY-MM-DD");
const next = addBusinessDays(d!, 3);
toIsoDate(next); // "2026-02-11"DST/Timezone matrix quick check
import { diffInDays, parseIsoDate } from "@jdsalasc/solvejs-date";
const usStart = parseIsoDate("2026-03-08T06:59:59.000Z");
const usEnd = parseIsoDate("2026-03-09T06:59:59.000Z");
const euStart = parseIsoDate("2026-03-29T00:59:59.000Z");
const euEnd = parseIsoDate("2026-03-30T00:59:59.000Z");
if (usStart && usEnd) diffInDays(usEnd, usStart); // 1
if (euStart && euEnd) diffInDays(euEnd, euStart); // 1