@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.
Files changed (2) hide show
  1. package/README.md +17 -11
  2. 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, type ParsedBSDate } from "@sonygrg/nepali-datepicker";
23
+ import { InputCalendar } from "@sonygrg/nepali-datepicker";
24
24
 
25
25
  function App() {
26
- const [date, setDate] = useState<ParsedBSDate | null>(null);
27
- return <InputCalendar value={date} onChange={(value) => setDate(value)} />;
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 | Description |
38
- | ---------- | -------------------------------------- | --------------------------------------------- |
39
- | `value` | `ParsedBSDate \| null` | The currently selected date (controlled mode) |
40
- | `onChange` | `(date: ParsedBSDate \| null) => void` | Called whenever the date changes |
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
- `ParsedBSDate` is shaped like:
43
- \`\`\`ts
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
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sonygrg/nepali-datepicker",
3
3
  "private": false,
4
- "version": "1.0.20",
4
+ "version": "1.0.21",
5
5
  "type": "module",
6
6
  "main": "./dist/nepali-datepicker.cjs.js",
7
7
  "module": "./dist/nepali-datepicker.es.js",