Date (helping-js/core/date)
Clone, add intervals, month bounds, a simple month grid, and ISO-ish parsing.
Imports
import {
cloneDate,
addDate,
getMonthStart,
getMonthEnd,
getCalendar,
parseISO,
isIsoFormat,
} from 'helping-js/core/date'
API
| Function | Role |
|---|---|
cloneDate(date) | New Date with same time |
addDate(date, { years, months, days, hours, minutes, seconds }) | Mutable-style copy; returns new date |
getMonthStart / getMonthEnd | Start/end of month |
getCalendar(year, month) | Weeks of `{ date, label } |
parseISO(str) | new Date(str) or null if invalid |
isIsoFormat(str) | Loose YYYY-MM-DD prefix check |
Samples
Shift a deadline
const end = addDate(new Date(), { days: 7 })
Calendar UI month
const weeks = getCalendar(2026, 3) // March 2026
// weeks[0] is first row (7 cells); cells are null or { date, label }
Express: parse date query
import { parseISO, isIsoFormat } from 'helping-js/core/date'
const since = req.query.since
const d = since && isIsoFormat(since) ? parseISO(since) : null
Vue: month range
import { getMonthStart, getMonthEnd } from 'helping-js/core/date'
const start = getMonthStart(selectedDate)
const end = getMonthEnd(selectedDate)
