@sbspk/bs 5.0.0 → 7.0.0
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/dist/calendar.js +25 -36
- package/dist/index.js +6 -14
- package/package.json +1 -1
package/dist/calendar.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = [
|
|
4
|
-
[1950, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31]],
|
|
5
|
-
[1951, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
6
|
-
[1952, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
7
|
-
[1953, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
8
|
-
[1954, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30]],
|
|
9
|
-
[1955, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
10
|
-
[1956, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
11
|
-
[1957, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
12
|
-
[1958, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30]],
|
|
13
|
-
[1959, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
14
|
-
[1960, [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
15
|
-
[1961, [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
16
|
-
[1962, [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
17
|
-
[1963, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
18
|
-
[1964, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30]],
|
|
19
|
-
[1965, [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
20
|
-
[1966, [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
21
|
-
[1967, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
22
|
-
[1968, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30]],
|
|
23
|
-
[1969, [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
1
|
+
export default [
|
|
24
2
|
[1970, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
25
3
|
[1971, [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30]],
|
|
26
4
|
[1972, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
@@ -28,11 +6,11 @@ exports.default = [
|
|
|
28
6
|
[1974, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
29
7
|
[1975, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
30
8
|
[1976, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
31
|
-
[1977, [30, 32, 31, 32, 31, 31, 29, 30,
|
|
9
|
+
[1977, [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31]],
|
|
32
10
|
[1978, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
33
11
|
[1979, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
34
12
|
[1980, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
35
|
-
[1981, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29,
|
|
13
|
+
[1981, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30]],
|
|
36
14
|
[1982, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
37
15
|
[1983, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
38
16
|
[1984, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
@@ -49,7 +27,7 @@ exports.default = [
|
|
|
49
27
|
[1995, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30]],
|
|
50
28
|
[1996, [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
51
29
|
[1997, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
52
|
-
[1998, [31, 31, 32, 31,
|
|
30
|
+
[1998, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
53
31
|
[1999, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
54
32
|
[2000, [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
55
33
|
[2001, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
@@ -113,7 +91,7 @@ exports.default = [
|
|
|
113
91
|
[2059, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
114
92
|
[2060, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
115
93
|
[2061, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
116
|
-
[2062, [
|
|
94
|
+
[2062, [31, 31, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31]],
|
|
117
95
|
[2063, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
118
96
|
[2064, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
119
97
|
[2065, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
@@ -132,13 +110,24 @@ exports.default = [
|
|
|
132
110
|
[2078, [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
133
111
|
[2079, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
134
112
|
[2080, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30]],
|
|
135
|
-
[2081, [31,
|
|
136
|
-
[2082, [
|
|
137
|
-
[2083, [31, 31, 32, 31, 31,
|
|
138
|
-
[2084, [31, 31, 32, 31,
|
|
139
|
-
[2085, [
|
|
140
|
-
[2086, [
|
|
141
|
-
[2087, [31, 31, 32,
|
|
142
|
-
[2088, [
|
|
143
|
-
[2089, [30, 32, 31, 32, 31, 30, 30, 30, 29, 30,
|
|
113
|
+
[2081, [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
114
|
+
[2082, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
115
|
+
[2083, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
116
|
+
[2084, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
117
|
+
[2085, [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
118
|
+
[2086, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
119
|
+
[2087, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
120
|
+
[2088, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
121
|
+
[2089, [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31]],
|
|
122
|
+
[2090, [31, 31, 32, 32, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
123
|
+
[2091, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
124
|
+
[2092, [30, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
125
|
+
[2093, [31, 31, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31]],
|
|
126
|
+
[2094, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
127
|
+
[2095, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
128
|
+
[2096, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]],
|
|
129
|
+
[2097, [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30]],
|
|
130
|
+
[2098, [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]],
|
|
131
|
+
[2099, [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]],
|
|
132
|
+
[2100, [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]]
|
|
144
133
|
];
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.toCommonEra = exports.toBikramSambat = void 0;
|
|
7
|
-
const calendar_1 = __importDefault(require("./calendar"));
|
|
8
|
-
const CALENDAR_MONTHS = calendar_1.default.flatMap((yearRow) => yearRow[1]);
|
|
9
|
-
const START_DATE_CE = Date.UTC(1893, 3, 12); // 1893-04-12
|
|
10
|
-
const START_YEAR_BS = calendar_1.default[0][0];
|
|
11
|
-
function toBikramSambat({ day, month, year }) {
|
|
1
|
+
import CALENDAR from './calendar';
|
|
2
|
+
const CALENDAR_MONTHS = CALENDAR.flatMap((yearRow) => yearRow[1]);
|
|
3
|
+
const START_DATE_CE = Date.UTC(1913, 4 - 1, 13); // 1913-04-13 js months are 0 indexed
|
|
4
|
+
const START_YEAR_BS = CALENDAR[0][0];
|
|
5
|
+
export function toBikramSambat({ day, month, year }) {
|
|
12
6
|
const date = Date.UTC(year, month - 1, day);
|
|
13
7
|
if (date < START_DATE_CE) {
|
|
14
8
|
throw new Error(`The date ${year}/${month}/${day} is not supported.`);
|
|
@@ -28,8 +22,7 @@ function toBikramSambat({ day, month, year }) {
|
|
|
28
22
|
}
|
|
29
23
|
throw new Error(`The date ${year}/${month}/${day} is not supported.`);
|
|
30
24
|
}
|
|
31
|
-
|
|
32
|
-
function toCommonEra({ year, month, day }) {
|
|
25
|
+
export function toCommonEra({ year, month, day }) {
|
|
33
26
|
const monthIndex = month - 1;
|
|
34
27
|
const yearIndex = year - START_YEAR_BS;
|
|
35
28
|
const previousMonthsRange = yearIndex * 12 + monthIndex;
|
|
@@ -49,4 +42,3 @@ function toCommonEra({ year, month, day }) {
|
|
|
49
42
|
day: date.getUTCDate()
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
|
-
exports.toCommonEra = toCommonEra;
|