You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41293c8
Browse filesBrowse the repository at this point in the historyBrowse files
Months are **1-indexed** to match Hamro Patro URLs (`/calendar/2083/1`).
16
19
17
-
## BS ↔ AD
20
+
## BS ↔ AD {#bs-ad}
18
21
19
22
`onSelect`, `onChange`, and `onValueChange` return **`BsDate` only** (Bikram Sambat year / month / day). They do **not** include the Gregorian (AD) date in the callback.
20
23
@@ -43,50 +46,4 @@ function handleSelect(bs: BsDate | undefined) {
43
46
|`formatAdDate(adDate, locale)`| Localized AD label for display |
44
47
|`getCurrentBsDate()`| Today as `BsDate` (from calendar data) |
The headless primitive mirrors the minimal [React DayPicker](https://daypicker.dev/) API. Install via **`bs-calendar`**; see [API overview](/api) for `BsDate` and [BS ↔ AD](/api#bs-ad).
Copy file name to clipboardExpand all lines: apps/docs/data.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,10 @@ type BsCalendarData = Record<string, Record<string, {
41
41
42
42
`2000` – `2089` BS (matching Hamro Patro navigation).
43
43
44
+
## Date + time pickers
45
+
46
+
`BsDateTimePicker` and `toAdDate()` resolve the Gregorian date from the same `bs-calendar.json` entries (`adDate` per BS day). If a day is missing from the dataset, `getDayAdDate` / `toAdDate` return `null` — handle that in submit handlers.
47
+
44
48
## Attribution
45
49
46
50
Hamro Patro is the authoritative source for BS–AD mapping and festival labels. Re-scrape periodically to pick up calendar corrections.
Copy file name to clipboardExpand all lines: apps/docs/getting-started.md
+79-10Lines changed: 79 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,19 @@
1
1
# Getting Started
2
2
3
-
**react-nepali-datetime-picker** is a registry-first Bikram Sambat calendar. Install components into your project the same way you add [shadcn/ui](https://ui.shadcn.com) components — they are copied into your codebase, not installed from npm.
3
+
**react-nepali-datetime-picker** is a registry-first Bikram Sambat calendar and picker suite. Install components into your project the same way you add [shadcn/ui](https://ui.shadcn.com) components — they are copied into your codebase, not installed from npm.
const ad =toAdDate(value) // Gregorian Date for APIs (e.g. trip planner)
144
+
if (!ad) return
145
+
// …
146
+
}
147
+
148
+
return (
149
+
<BsDateTimePicker
150
+
value={value}
151
+
onChange={setValue}
152
+
locale="ne"
153
+
placeholder="मिति र समय छान्नुहोस्"
154
+
/>
155
+
)
156
+
}
157
+
```
158
+
90
159
## React Native
91
160
92
-
See [React Native](/react-native) for the NativeWind registry install and `PortalHost` notes.
161
+
See [React Native](/react-native) for the NativeWind registry install, platform files, and `PortalHost` notes.
93
162
94
163
## Headless usage
95
164
96
-
The copied `lib/bs-day-picker/` folder includes a headless `BsDayPicker` and `useBsCalendar` hook if you want to build a fully custom UI.
165
+
The copied `lib/bs-day-picker/` folder includes a headless [BsDayPicker](/api/day-picker) and `useBsCalendar` hook if you want to build a fully custom UI. Time helpers live under `lib/bs-time-picker/`.
0 commit comments