@gambhirpoudel/nepali-calendar-kit 1.0.0 → 1.0.2
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.
Potentially problematic release.
This version of @gambhirpoudel/nepali-calendar-kit might be problematic. Click here for more details.
- package/package.json +24 -22
- package/src/components/DayCell.tsx +0 -17
- package/src/components/MonthView.tsx +0 -21
- package/src/components/NepaliCalendar.tsx +0 -19
- package/src/core/adToBs.ts +0 -23
- package/src/core/bsToAd.ts +0 -18
- package/src/core/constants.ts +0 -4
- package/src/data/bsMonthData.ts +0 -157
- package/src/hooks/useNepaliDate.ts +0 -10
- package/src/index.ts +0 -6
- package/tests/conversion.test.ts +0 -13
- package/tests/reversibility.test.ts +0 -14
- package/tsconfig.json +0 -15
- package/vitest.config.ts +0 -8
package/package.json
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gambhirpoudel/nepali-calendar-kit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Accurate Nepali Calendar with AD ↔ BS conversion and customizable UI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/ZaddyAI/nepali-calendar-kit.git"
|
|
10
18
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
"keywords": [
|
|
20
|
+
"nepali-calendar",
|
|
21
|
+
"bs-ad",
|
|
22
|
+
"react",
|
|
23
|
+
"nextjs"
|
|
24
|
+
],
|
|
25
|
+
"author": "Gambhir Poudel",
|
|
15
26
|
"license": "ISC",
|
|
16
|
-
"type": "commonjs",
|
|
17
27
|
"dependencies": {
|
|
18
28
|
"react": "^19.2.3",
|
|
19
29
|
"react-dom": "^19.2.3"
|
|
20
30
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"@types/react-dom": "^19.2.3",
|
|
24
|
-
"tsup": "^8.5.1",
|
|
25
|
-
"typescript": "^5.9.3",
|
|
26
|
-
"vitest": "^4.0.17"
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "https://github.com/ZaddyAI/nepali-calendar-kit.git"
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "rm -rf dist && cp -r src dist"
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface DayCellProps {
|
|
4
|
-
day: number;
|
|
5
|
-
month: number;
|
|
6
|
-
year: number;
|
|
7
|
-
isSelected?: boolean;
|
|
8
|
-
render?: (day: number, month: number, year: number, isSelected?: boolean) => React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const DayCell: React.FC<DayCellProps> = ({ day, month, year, isSelected, render }) => {
|
|
12
|
-
return (
|
|
13
|
-
<div className={`day-cell ${isSelected ? "selected" : ""}`}>
|
|
14
|
-
{render ? render(day, month, year, isSelected) : day}
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DayCell } from "./DayCell";
|
|
3
|
-
import { BS_MONTH_DATA } from "../data/bsMonthData";
|
|
4
|
-
|
|
5
|
-
interface MonthViewProps {
|
|
6
|
-
year: number;
|
|
7
|
-
month: number;
|
|
8
|
-
renderDay?: (day: number, month: number, year: number) => React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const MonthView: React.FC<MonthViewProps> = ({ year, month, renderDay }) => {
|
|
12
|
-
const daysInMonth = BS_MONTH_DATA[year][month - 1];
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className="month-view-grid">
|
|
16
|
-
{Array.from({ length: daysInMonth }, (_, i) => (
|
|
17
|
-
<DayCell key={i} day={i + 1} month={month} year={year} render={renderDay} />
|
|
18
|
-
))}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { adToBs } from "../core/adToBs";
|
|
3
|
-
import { MonthView } from "./MonthView";
|
|
4
|
-
|
|
5
|
-
interface NepaliCalendarProps {
|
|
6
|
-
date?: Date;
|
|
7
|
-
renderDay?: (day: number, month: number, year: number) => React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const NepaliCalendar: React.FC<NepaliCalendarProps> = ({ date = new Date(), renderDay }) => {
|
|
11
|
-
const [current, setCurrent] = useState(adToBs(date));
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className="nepali-calendar">
|
|
15
|
-
<MonthView year={current.year} month={current.month} renderDay={renderDay} />
|
|
16
|
-
{/* You can extend with Month/Year navigation */}
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
};
|
package/src/core/adToBs.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AD_ANCHOR, BS_ANCHOR } from "./constants";
|
|
2
|
-
import { BS_MONTH_DATA } from "../data/bsMonthData";
|
|
3
|
-
|
|
4
|
-
export function adToBs(ad: Date) {
|
|
5
|
-
let days = Math.floor((ad.getTime() - AD_ANCHOR.getTime()) / 86400000);
|
|
6
|
-
let { year, month, day } = { ...BS_ANCHOR };
|
|
7
|
-
|
|
8
|
-
while (days > 0) {
|
|
9
|
-
const daysInMonth = BS_MONTH_DATA[year][month - 1];
|
|
10
|
-
day++;
|
|
11
|
-
if (day > daysInMonth) {
|
|
12
|
-
day = 1;
|
|
13
|
-
month++;
|
|
14
|
-
if (month > 12) {
|
|
15
|
-
month = 1;
|
|
16
|
-
year++;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
days--;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return { year, month, day };
|
|
23
|
-
}
|
package/src/core/bsToAd.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AD_ANCHOR, BS_ANCHOR } from "./constants";
|
|
2
|
-
import { BS_MONTH_DATA } from "../data/bsMonthData";
|
|
3
|
-
|
|
4
|
-
export function bsToAd(year: number, month: number, day: number): Date {
|
|
5
|
-
let totalDays = 0;
|
|
6
|
-
|
|
7
|
-
for (let y = BS_ANCHOR.year; y < year; y++) {
|
|
8
|
-
totalDays += BS_MONTH_DATA[y].reduce((a, b) => a + b, 0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
for (let m = 1; m < month; m++) {
|
|
12
|
-
totalDays += BS_MONTH_DATA[year][m - 1];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
totalDays += day - 1;
|
|
16
|
-
|
|
17
|
-
return new Date(AD_ANCHOR.getTime() + totalDays * 86400000);
|
|
18
|
-
}
|
package/src/core/constants.ts
DELETED
package/src/data/bsMonthData.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
export const BS_MONTH_DATA: Record<number, number[]> = {
|
|
2
|
-
1970: [31, 31, 32, 31, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
3
|
-
1971: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
4
|
-
1972: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
5
|
-
1973: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
6
|
-
1974: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
7
|
-
1975: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
8
|
-
1976: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
9
|
-
1977: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
10
|
-
1978: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
11
|
-
1979: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
12
|
-
1980: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
13
|
-
1981: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
14
|
-
1982: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
15
|
-
1983: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
16
|
-
1984: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
17
|
-
1985: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
18
|
-
1986: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
19
|
-
1987: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
20
|
-
1988: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
21
|
-
1989: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
22
|
-
1990: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
23
|
-
1991: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
24
|
-
1992: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
25
|
-
1993: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
26
|
-
1994: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
27
|
-
1995: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
28
|
-
1996: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
29
|
-
1997: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
30
|
-
1998: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
31
|
-
1999: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
32
|
-
2000: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
33
|
-
2001: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
34
|
-
2002: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
35
|
-
2003: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
36
|
-
2004: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
37
|
-
2005: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
38
|
-
2006: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
39
|
-
2007: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
40
|
-
2008: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
41
|
-
2009: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
42
|
-
2010: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
43
|
-
2011: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
44
|
-
2012: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
45
|
-
2013: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
46
|
-
2014: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
47
|
-
2015: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
48
|
-
2016: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
49
|
-
2017: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
50
|
-
2018: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
51
|
-
2019: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
52
|
-
2020: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
53
|
-
2021: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
54
|
-
2022: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
55
|
-
2023: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
56
|
-
2024: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
57
|
-
2025: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
58
|
-
2026: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
59
|
-
2027: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
60
|
-
2028: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
61
|
-
2029: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
62
|
-
2030: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
63
|
-
2031: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
64
|
-
2032: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
65
|
-
2033: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
66
|
-
2034: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
67
|
-
2035: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
68
|
-
2036: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
69
|
-
2037: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
70
|
-
2038: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
71
|
-
2039: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
72
|
-
2040: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
73
|
-
2041: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
74
|
-
2042: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
75
|
-
2043: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
76
|
-
2044: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
77
|
-
2045: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
78
|
-
2046: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
79
|
-
2047: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
80
|
-
2048: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
81
|
-
2049: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
82
|
-
2050: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
83
|
-
2051: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
84
|
-
2052: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
85
|
-
2053: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
86
|
-
2054: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
87
|
-
2055: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
88
|
-
2056: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
89
|
-
2057: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
90
|
-
2058: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
91
|
-
2059: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
92
|
-
2060: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
93
|
-
2061: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
94
|
-
2062: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
95
|
-
2063: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
96
|
-
2064: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
97
|
-
2065: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
98
|
-
2066: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
99
|
-
2067: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
100
|
-
2068: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
101
|
-
2069: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
102
|
-
2070: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
103
|
-
2071: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
104
|
-
2072: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
105
|
-
2073: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
106
|
-
2074: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
107
|
-
2075: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
108
|
-
2076: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
109
|
-
2077: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
110
|
-
2078: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
111
|
-
2079: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
112
|
-
2080: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
113
|
-
2081: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
114
|
-
2082: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
115
|
-
2083: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
116
|
-
2084: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
117
|
-
2085: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
118
|
-
2086: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
119
|
-
2087: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
120
|
-
2088: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
121
|
-
2089: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
122
|
-
2090: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
123
|
-
2091: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
124
|
-
2092: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
125
|
-
2093: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
126
|
-
2094: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
127
|
-
2095: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
128
|
-
2096: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
129
|
-
2097: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
130
|
-
2098: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
131
|
-
2099: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
132
|
-
2100: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
133
|
-
2101: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
134
|
-
2102: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
135
|
-
2103: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
136
|
-
2104: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
137
|
-
2105: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
138
|
-
2106: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
139
|
-
2107: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
140
|
-
2108: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
141
|
-
2109: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
142
|
-
2110: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
143
|
-
2111: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
144
|
-
2112: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
145
|
-
2113: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
146
|
-
2114: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
147
|
-
2115: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
148
|
-
2116: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
149
|
-
2117: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
150
|
-
2118: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
151
|
-
2119: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
152
|
-
2120: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
153
|
-
2121: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
154
|
-
2122: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
155
|
-
2123: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
156
|
-
2124: [31, 31, 32, 31, 32, 30, 29, 30, 29, 30, 29, 31],
|
|
157
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { adToBs } from "../core/adToBs";
|
|
2
|
-
import { bsToAd } from "../core/bsToAd";
|
|
3
|
-
|
|
4
|
-
export function useNepaliDate(adDate: Date = new Date()) {
|
|
5
|
-
const bs = adToBs(adDate);
|
|
6
|
-
|
|
7
|
-
const toAD = () => bsToAd(bs.year, bs.month, bs.day);
|
|
8
|
-
|
|
9
|
-
return { bs, toAD };
|
|
10
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { adToBs } from "./core/adToBs";
|
|
2
|
-
export { bsToAd } from "./core/bsToAd";
|
|
3
|
-
export { useNepaliDate } from "./hooks/useNepaliDate";
|
|
4
|
-
export { NepaliCalendar } from "./components/NepaliCalendar";
|
|
5
|
-
export { DayCell } from "./components/DayCell";
|
|
6
|
-
export { MonthView } from "./components/MonthView";
|
package/tests/conversion.test.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { adToBs } from "../src/core/adToBs";
|
|
3
|
-
import { bsToAd } from "../src/core/bsToAd";
|
|
4
|
-
|
|
5
|
-
describe("AD ↔ BS Conversion Reversibility", () => {
|
|
6
|
-
it("AD → BS → AD returns the same AD date", () => {
|
|
7
|
-
const ad = new Date("2025-01-13");
|
|
8
|
-
const bs = adToBs(ad);
|
|
9
|
-
const back = bsToAd(bs.year, bs.month, bs.day);
|
|
10
|
-
|
|
11
|
-
expect(back.toISOString()).toBe(ad.toISOString());
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { adToBs } from "../src/core/adToBs";
|
|
3
|
-
import { bsToAd } from "../src/core/bsToAd";
|
|
4
|
-
|
|
5
|
-
describe("AD ↔ BS Conversion Reversibility", () => {
|
|
6
|
-
it("AD → BS → AD should return the same AD date", () => {
|
|
7
|
-
const ad = new Date("2025-01-13");
|
|
8
|
-
const bs = adToBs(ad);
|
|
9
|
-
const back = bsToAd(bs.year, bs.month, bs.day);
|
|
10
|
-
|
|
11
|
-
expect(back.toISOString()).toBe(ad.toISOString());
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES6",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"]
|
|
15
|
-
}
|