@vahidamirian/datepicker-core
v1.0.0
Published
Framework-agnostic headless core for the NDP date picker: Jalali/Gregorian/Hijri calendar math, adapters, and render-ready view builders. Zero framework dependencies.
Maintainers
Readme
@vahidamirian/datepicker-core
Framework-agnostic headless core for the NDP date picker. Pure TypeScript with
zero framework dependencies — the shared foundation under
@vahidamirian/ngx-jalali-datepicker and @vahidamirian/vue-datepicker.
It ships:
- Calendar adapters —
GregorianCalendarAdapter,JalaliCalendarAdapter,HijriCalendarAdapter, and theCalendarAdapterabstract base you implement to add your own calendar. - Conversion math —
JalaaliMath,HijriMath(dependency-free, verified against the platformIntlcalendars). - Render-ready view builders —
buildMonthView,buildMonthsView,buildYearsView: every per-cell flag (selected / in-range / disabled / today …) precomputed once so any UI layer only reads booleans. - Pure logic —
applySelection,isSelectionComplete,rangeEquals, time-of-day helpers (getTimeOfDay,withTimeOfDay,snapMinutes,stepMinutes), and thedayKey/ digit utilities.
import { JalaliCalendarAdapter, buildMonthView, applySelection } from '@vahidamirian/datepicker-core';
const cal = new JalaliCalendarAdapter();
cal.parse('۱۴۰۴/۰۳/۲۸'); // Date | nullBuild a completely custom UI on top of this, or use a framework package. See the repo README for the full API.
License
MIT © Vahid Amirian
