@sonygrg/nepali-datepicker 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,11 +20,18 @@ npm install react react-dom @mui/material @mui/x-date-pickers @emotion/react @em
|
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
22
|
import { useState } from "react";
|
|
23
|
-
import { InputCalendar
|
|
23
|
+
import { InputCalendar } from "@sonygrg/nepali-datepicker";
|
|
24
24
|
|
|
25
25
|
function App() {
|
|
26
|
-
const [date, setDate] = useState<
|
|
27
|
-
|
|
26
|
+
const [date, setDate] = useState<string | null>(null);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<InputCalendar
|
|
30
|
+
value={date}
|
|
31
|
+
onChange={(value) => setDate(value)}
|
|
32
|
+
format="YYYY-MM-DD" // Accepts either "YYYY-MM-DD" or "YYYY/MM/DD"
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
export default App;
|
|
@@ -34,15 +41,14 @@ export default App;
|
|
|
34
41
|
|
|
35
42
|
### Props
|
|
36
43
|
|
|
37
|
-
| Prop | Type
|
|
38
|
-
| ---------- |
|
|
39
|
-
| `value` | `
|
|
40
|
-
| `onChange` | `(date:
|
|
44
|
+
| Prop | Type | Description |
|
|
45
|
+
| ---------- | -------------------------------- | --------------------------------------------- |
|
|
46
|
+
| `value` | `string\| null` | The currently selected date (controlled mode) |
|
|
47
|
+
| `onChange` | `(date: string \| null) => void` | Called whenever the date changes |
|
|
48
|
+
| `format` | `"YYYY-MM-DD" \| "YYYY/MM/DD"` | Format of the input and output date string |
|
|
41
49
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{ year: number; month: number; day: number }
|
|
45
|
-
\`\`\`
|
|
50
|
+
[IMPORTANT]
|
|
51
|
+
The format prop only accepts "YYYY-MM-DD" or "YYYY/MM/DD". Passing any other variations or custom formats will not work as expected.
|
|
46
52
|
|
|
47
53
|
## Features
|
|
48
54
|
|