react-native-nepali-picker 1.0.7 → 1.0.9
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/lib/commonjs/CalendarPicker.js +4 -4
- package/lib/commonjs/CalendarPicker.js.map +1 -1
- package/lib/commonjs/assets/DateSync.js +7 -6
- package/lib/commonjs/assets/Triangle.js +3 -3
- package/lib/commonjs/calendar/config.js +1 -1
- package/lib/commonjs/calendar/functions.js +5 -1
- package/lib/commonjs/index.js.map +1 -2
- package/lib/module/CalendarPicker.js +51 -74
- package/lib/module/CalendarPicker.js.map +1 -2
- package/lib/module/assets/DateSync.js +7 -6
- package/lib/module/assets/DateSync.js.map +0 -1
- package/lib/module/assets/Icons.js +12 -18
- package/lib/module/assets/Icons.js.map +0 -1
- package/lib/module/assets/Triangle.js +3 -3
- package/lib/module/assets/Triangle.js.map +0 -1
- package/lib/module/assets/cIcon.js.map +0 -1
- package/lib/module/calendar/config.js +1 -1
- package/lib/module/calendar/functions.js +5 -1
- package/lib/module/types.js.map +0 -1
- package/package.json +2 -2
- package/src/CalendarPicker.tsx +7 -7
- package/src/calendar/config.ts +1 -1
- package/src/CalendarPicker.js +0 -283
- package/src/assets/DateSync.js +0 -66
- package/src/assets/Icons.js +0 -109
- package/src/assets/Triangle.js +0 -25
- package/src/assets/cIcon.js +0 -45
- package/src/calendar/config.js +0 -149
- package/src/calendar/functions.js +0 -121
- package/src/calendar/settings.js +0 -35
- package/src/index.js +0 -2
- package/src/types.js +0 -1
package/src/assets/Icons.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
const ChevronIcon = ({ direction = 'right', size = 15, color = '#000' }) => {
|
|
4
|
-
const isLeft = direction === 'left';
|
|
5
|
-
return (_jsxs(View, { style: [styles.container, { width: size, height: size }], children: [_jsx(View, { style: [
|
|
6
|
-
styles.line,
|
|
7
|
-
isLeft ? styles.leftTop : styles.rightTop,
|
|
8
|
-
{ backgroundColor: color },
|
|
9
|
-
] }), _jsx(View, { style: [
|
|
10
|
-
styles.line,
|
|
11
|
-
isLeft ? styles.leftBottom : styles.rightBottom,
|
|
12
|
-
{ backgroundColor: color },
|
|
13
|
-
] })] }));
|
|
14
|
-
};
|
|
15
|
-
const EditPencilIcon = ({ size = 24, color = '#000' }) => {
|
|
16
|
-
return (_jsxs(View, { style: [styles.container, { width: size, height: size }], children: [_jsx(View, { style: [styles.pencilBody, { backgroundColor: color }] }), _jsx(View, { style: [styles.pencilTip, { borderBottomColor: color }] }), _jsx(View, { style: [styles.pencilEraser, { backgroundColor: '#FFA07A' }] })] }));
|
|
17
|
-
};
|
|
18
|
-
const Triangle = ({ width = 10, height = 20, color = 'white' }) => {
|
|
19
|
-
return (_jsx(View, { style: [
|
|
20
|
-
styles.triangle,
|
|
21
|
-
{
|
|
22
|
-
borderLeftWidth: width / 2,
|
|
23
|
-
borderRightWidth: width / 2,
|
|
24
|
-
borderBottomWidth: height,
|
|
25
|
-
borderBottomColor: color,
|
|
26
|
-
},
|
|
27
|
-
] }));
|
|
28
|
-
};
|
|
29
|
-
const ChevronDown = ({ size = 10, color = '#000' }) => {
|
|
30
|
-
return (_jsxs(View, { style: [
|
|
31
|
-
styles.container,
|
|
32
|
-
{ width: size, height: size, transform: [{ rotate: '-90deg' }] },
|
|
33
|
-
], children: [_jsx(View, { style: [styles.line, styles.rightTop, { backgroundColor: color }] }), _jsx(View, { style: [styles.line, styles.rightBottom, { backgroundColor: color }] })] }));
|
|
34
|
-
};
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
container: {
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
},
|
|
40
|
-
line: {
|
|
41
|
-
position: 'absolute',
|
|
42
|
-
width: '90%',
|
|
43
|
-
height: 2,
|
|
44
|
-
},
|
|
45
|
-
leftTop: {
|
|
46
|
-
top: '15%',
|
|
47
|
-
left: '20%',
|
|
48
|
-
transform: [{ rotate: '45deg' }],
|
|
49
|
-
},
|
|
50
|
-
leftBottom: {
|
|
51
|
-
bottom: '15%',
|
|
52
|
-
left: '20%',
|
|
53
|
-
transform: [{ rotate: '-45deg' }],
|
|
54
|
-
},
|
|
55
|
-
rightTop: {
|
|
56
|
-
top: '15%',
|
|
57
|
-
right: '20%',
|
|
58
|
-
transform: [{ rotate: '-45deg' }],
|
|
59
|
-
},
|
|
60
|
-
rightBottom: {
|
|
61
|
-
bottom: '15%',
|
|
62
|
-
right: '20%',
|
|
63
|
-
transform: [{ rotate: '45deg' }],
|
|
64
|
-
},
|
|
65
|
-
triangle: {
|
|
66
|
-
width: 0,
|
|
67
|
-
height: 0,
|
|
68
|
-
backgroundColor: 'transparent',
|
|
69
|
-
borderStyle: 'solid',
|
|
70
|
-
borderLeftWidth: 6,
|
|
71
|
-
borderRightWidth: 6,
|
|
72
|
-
borderBottomWidth: 0,
|
|
73
|
-
borderLeftColor: 'transparent',
|
|
74
|
-
borderRightColor: 'transparent',
|
|
75
|
-
borderTopWidth: 8,
|
|
76
|
-
},
|
|
77
|
-
pencilBody: {
|
|
78
|
-
width: '60%',
|
|
79
|
-
height: '75%',
|
|
80
|
-
position: 'absolute',
|
|
81
|
-
bottom: '12.5%',
|
|
82
|
-
left: '20%',
|
|
83
|
-
transform: [{ skewX: '5deg' }],
|
|
84
|
-
},
|
|
85
|
-
pencilTip: {
|
|
86
|
-
width: 0,
|
|
87
|
-
height: 0,
|
|
88
|
-
backgroundColor: 'transparent',
|
|
89
|
-
borderStyle: 'solid',
|
|
90
|
-
borderLeftWidth: 7,
|
|
91
|
-
borderRightWidth: 7,
|
|
92
|
-
borderTopWidth: 0,
|
|
93
|
-
borderLeftColor: 'transparent',
|
|
94
|
-
borderRightColor: 'transparent',
|
|
95
|
-
borderBottomWidth: 10,
|
|
96
|
-
position: 'absolute',
|
|
97
|
-
bottom: '12.5%',
|
|
98
|
-
left: '20%',
|
|
99
|
-
},
|
|
100
|
-
pencilEraser: {
|
|
101
|
-
width: '60%',
|
|
102
|
-
height: '10%',
|
|
103
|
-
position: 'absolute',
|
|
104
|
-
top: '12.5%',
|
|
105
|
-
left: '20%',
|
|
106
|
-
transform: [{ skewX: '5deg' }],
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
export { ChevronIcon, ChevronDown, EditPencilIcon, Triangle };
|
package/src/assets/Triangle.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
const Triangle = ({ width = 10, height = 20, color = 'black' }) => {
|
|
4
|
-
return (_jsx(View, { style: [
|
|
5
|
-
styles.triangle,
|
|
6
|
-
{
|
|
7
|
-
borderLeftWidth: width / 2,
|
|
8
|
-
borderRightWidth: width / 2,
|
|
9
|
-
borderBottomWidth: height,
|
|
10
|
-
borderBottomColor: color,
|
|
11
|
-
},
|
|
12
|
-
] }));
|
|
13
|
-
};
|
|
14
|
-
const styles = StyleSheet.create({
|
|
15
|
-
triangle: {
|
|
16
|
-
width: 0,
|
|
17
|
-
height: 0,
|
|
18
|
-
transform: [{ rotate: '180deg' }],
|
|
19
|
-
backgroundColor: 'transparent',
|
|
20
|
-
borderStyle: 'solid',
|
|
21
|
-
borderLeftColor: 'transparent',
|
|
22
|
-
borderRightColor: 'transparent',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export default Triangle;
|
package/src/assets/cIcon.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
const PencilIcon = ({ height = 20, width = 10 }) => {
|
|
4
|
-
return (_jsxs(View, { style: { ...styles.container, height: height, width: width }, children: [_jsx(View, { style: {
|
|
5
|
-
height: '40%',
|
|
6
|
-
width: '100%',
|
|
7
|
-
borderTopStartRadius: 3,
|
|
8
|
-
borderTopEndRadius: 3,
|
|
9
|
-
borderWidth: 0.7,
|
|
10
|
-
}, children: _jsx(View, { style: {
|
|
11
|
-
top: '50%',
|
|
12
|
-
width: '100%',
|
|
13
|
-
borderWidth: 0.7,
|
|
14
|
-
} }) }), _jsx(View, { style: {
|
|
15
|
-
height: '90%',
|
|
16
|
-
width: '100%',
|
|
17
|
-
borderWidth: 0.7,
|
|
18
|
-
}, children: _jsx(View, { style: {
|
|
19
|
-
left: '50%',
|
|
20
|
-
height: '100%',
|
|
21
|
-
width: 0,
|
|
22
|
-
borderWidth: 0.2,
|
|
23
|
-
} }) }), _jsx(View, { style: {
|
|
24
|
-
width: 0,
|
|
25
|
-
height: 0,
|
|
26
|
-
borderLeftWidth: 4,
|
|
27
|
-
borderRightWidth: 4,
|
|
28
|
-
borderBottomWidth: 0,
|
|
29
|
-
borderStyle: 'solid',
|
|
30
|
-
backgroundColor: 'transparent',
|
|
31
|
-
borderLeftColor: 'transparent',
|
|
32
|
-
borderRightColor: 'transparent',
|
|
33
|
-
borderBottomColor: 'transparent',
|
|
34
|
-
borderTopWidth: 8,
|
|
35
|
-
} })] }));
|
|
36
|
-
};
|
|
37
|
-
const styles = StyleSheet.create({
|
|
38
|
-
container: {
|
|
39
|
-
transform: [{ rotate: '45deg' }],
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
marginHorizontal: 'auto',
|
|
42
|
-
justifyContent: 'center',
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
export default PencilIcon;
|
package/src/calendar/config.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
const bs = [];
|
|
2
|
-
bs[2000] = [2000, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
3
|
-
bs[2001] = [2001, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
4
|
-
bs[2002] = [2002, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
5
|
-
bs[2003] = [2003, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
6
|
-
bs[2004] = [2004, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
7
|
-
bs[2005] = [2005, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
8
|
-
bs[2006] = [2006, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
9
|
-
bs[2007] = [2007, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
10
|
-
bs[2008] = [2008, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31];
|
|
11
|
-
bs[2009] = [2009, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
12
|
-
bs[2010] = [2010, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
13
|
-
bs[2011] = [2011, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
14
|
-
bs[2012] = [2012, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
15
|
-
bs[2013] = [2013, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
16
|
-
bs[2014] = [2014, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
17
|
-
bs[2015] = [2015, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
18
|
-
bs[2016] = [2016, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
19
|
-
bs[2017] = [2017, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
20
|
-
bs[2018] = [2018, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
21
|
-
bs[2019] = [2019, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
22
|
-
bs[2020] = [2020, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
23
|
-
bs[2021] = [2021, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
24
|
-
bs[2022] = [2022, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30];
|
|
25
|
-
bs[2023] = [2023, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
26
|
-
bs[2024] = [2024, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
27
|
-
bs[2025] = [2025, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
28
|
-
bs[2026] = [2026, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
29
|
-
bs[2027] = [2027, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
30
|
-
bs[2028] = [2028, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
31
|
-
bs[2029] = [2029, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30];
|
|
32
|
-
bs[2030] = [2030, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
33
|
-
bs[2031] = [2031, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
34
|
-
bs[2032] = [2032, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
35
|
-
bs[2033] = [2033, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
36
|
-
bs[2034] = [2034, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
37
|
-
bs[2035] = [2035, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31];
|
|
38
|
-
bs[2036] = [2036, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
39
|
-
bs[2037] = [2037, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
40
|
-
bs[2038] = [2038, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
41
|
-
bs[2039] = [2039, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
42
|
-
bs[2040] = [2040, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
43
|
-
bs[2041] = [2041, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
44
|
-
bs[2042] = [2042, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
45
|
-
bs[2043] = [2043, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
46
|
-
bs[2044] = [2044, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
47
|
-
bs[2045] = [2045, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
48
|
-
bs[2046] = [2046, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
49
|
-
bs[2047] = [2047, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
50
|
-
bs[2048] = [2048, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
51
|
-
bs[2049] = [2049, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30];
|
|
52
|
-
bs[2050] = [2050, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
53
|
-
bs[2051] = [2051, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
54
|
-
bs[2052] = [2052, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
55
|
-
bs[2053] = [2053, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30];
|
|
56
|
-
bs[2054] = [2054, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
57
|
-
bs[2055] = [2055, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
58
|
-
bs[2056] = [2056, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30];
|
|
59
|
-
bs[2057] = [2057, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
60
|
-
bs[2058] = [2058, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
61
|
-
bs[2059] = [2059, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
62
|
-
bs[2060] = [2060, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
63
|
-
bs[2061] = [2061, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
64
|
-
bs[2062] = [2062, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31];
|
|
65
|
-
bs[2063] = [2063, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
66
|
-
bs[2064] = [2064, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
67
|
-
bs[2065] = [2065, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
68
|
-
bs[2066] = [2066, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31];
|
|
69
|
-
bs[2067] = [2067, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
70
|
-
bs[2068] = [2068, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
71
|
-
bs[2069] = [2069, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
72
|
-
bs[2070] = [2070, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
73
|
-
bs[2071] = [2071, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
74
|
-
bs[2072] = [2072, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
75
|
-
bs[2073] = [2073, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
76
|
-
bs[2074] = [2074, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
77
|
-
bs[2075] = [2075, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
78
|
-
bs[2076] = [2076, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30];
|
|
79
|
-
bs[2077] = [2077, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
80
|
-
bs[2078] = [2078, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
81
|
-
bs[2079] = [2079, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
82
|
-
bs[2080] = [2080, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30];
|
|
83
|
-
bs[2081] = [2081, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
84
|
-
bs[2082] = [2082, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
85
|
-
bs[2083] = [2083, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
86
|
-
bs[2084] = [2084, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
87
|
-
bs[2085] = [2085, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
88
|
-
bs[2086] = [2086, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
89
|
-
bs[2087] = [2087, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
90
|
-
bs[2088] = [2088, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
91
|
-
bs[2089] = [2089, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31];
|
|
92
|
-
bs[2090] = [2090, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
93
|
-
bs[2091] = [2091, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
94
|
-
bs[2092] = [2092, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
95
|
-
bs[2093] = [2093, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31];
|
|
96
|
-
bs[2094] = [2094, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
97
|
-
bs[2095] = [2095, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
98
|
-
bs[2096] = [2096, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31];
|
|
99
|
-
bs[2097] = [2097, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30];
|
|
100
|
-
bs[2098] = [2098, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30];
|
|
101
|
-
bs[2099] = [2099, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30];
|
|
102
|
-
const leapYears = [];
|
|
103
|
-
for (let i = 2000; i < 2100; i++) {
|
|
104
|
-
let totalD = 0;
|
|
105
|
-
for (let j = 1; j <= 12; j++) {
|
|
106
|
-
totalD += bs[i][j];
|
|
107
|
-
}
|
|
108
|
-
if (totalD === 366)
|
|
109
|
-
leapYears.push(i);
|
|
110
|
-
}
|
|
111
|
-
const daysInEnglish = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
112
|
-
const daysInNepali = ['आइत', 'सोम', 'मंगल', 'बुध', 'बिहि', 'शुक्र', 'शनि'];
|
|
113
|
-
const monthsInEnglish = [
|
|
114
|
-
'Baishakh',
|
|
115
|
-
'Jestha',
|
|
116
|
-
'Ashadh',
|
|
117
|
-
'Shrawan',
|
|
118
|
-
'Bhadra',
|
|
119
|
-
'Ashoj',
|
|
120
|
-
'Kartik',
|
|
121
|
-
'Mangsir',
|
|
122
|
-
'Poush',
|
|
123
|
-
'Magh',
|
|
124
|
-
'Falgun',
|
|
125
|
-
'Chaitra',
|
|
126
|
-
];
|
|
127
|
-
const monthsInNepali = [
|
|
128
|
-
'बैशाख',
|
|
129
|
-
'जेठ',
|
|
130
|
-
'असार',
|
|
131
|
-
'श्रावण',
|
|
132
|
-
'भदौ',
|
|
133
|
-
'असोज',
|
|
134
|
-
'कार्तिक',
|
|
135
|
-
'मंसिर',
|
|
136
|
-
'पुष',
|
|
137
|
-
'माघ',
|
|
138
|
-
'फाल्गुन',
|
|
139
|
-
'चैत्र',
|
|
140
|
-
];
|
|
141
|
-
const nepaliNumber = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];
|
|
142
|
-
const getNepaliNumber = (engNum) => {
|
|
143
|
-
return engNum
|
|
144
|
-
.toString()
|
|
145
|
-
.split('')
|
|
146
|
-
.map((n) => nepaliNumber[n])
|
|
147
|
-
.join('');
|
|
148
|
-
};
|
|
149
|
-
export { bs, daysInNepali, daysInEnglish, monthsInNepali, monthsInEnglish, getNepaliNumber, leapYears, };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { bs } from './config';
|
|
2
|
-
const formatDate = (date) => {
|
|
3
|
-
const year = date.getFullYear();
|
|
4
|
-
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
|
|
5
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
6
|
-
return `${year}-${month}-${day}`;
|
|
7
|
-
};
|
|
8
|
-
export const validateDate = (date) => {
|
|
9
|
-
const dateArray = date.split('-');
|
|
10
|
-
const [userYear, userMonth, _] = dateArray.map(Number);
|
|
11
|
-
if (dateArray.length !== 3) {
|
|
12
|
-
return 'Invalid date format';
|
|
13
|
-
}
|
|
14
|
-
else if (userYear < 2000 || userYear >= 2100) {
|
|
15
|
-
return 'Year Range is 2000 to 2099';
|
|
16
|
-
}
|
|
17
|
-
else if (userMonth < 1 || userMonth > 12) {
|
|
18
|
-
return 'Month Range is 1 to 12';
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const FindDateDifference = (date1, date2) => {
|
|
25
|
-
const diffInMs = date2 - date1;
|
|
26
|
-
const diffInDays = diffInMs / (1000 * 60 * 60 * 24);
|
|
27
|
-
return diffInDays;
|
|
28
|
-
};
|
|
29
|
-
const AdToBs = (UserDate) => {
|
|
30
|
-
const ReferenceDate = new Date('1943-04-14').getTime();
|
|
31
|
-
const UserTimeDate = new Date(UserDate).getTime();
|
|
32
|
-
if (UserTimeDate < ReferenceDate) {
|
|
33
|
-
console.log('The minimum possible date you can enter is 2024-04-13 i.e 2081-01-01');
|
|
34
|
-
return 'The minimum possible date you can enter is 2024-04-13 i.e 2081-01-01';
|
|
35
|
-
}
|
|
36
|
-
// number of days from that reference date
|
|
37
|
-
const DateDifference = FindDateDifference(ReferenceDate, UserTimeDate);
|
|
38
|
-
let nepaliYear = 2000;
|
|
39
|
-
let nepaliMonth = 1;
|
|
40
|
-
let nepaliDay = 1;
|
|
41
|
-
//difference can calculate upto previous day so add 1 to get current day(Today)
|
|
42
|
-
let DD = DateDifference + 1;
|
|
43
|
-
outerLoop: for (let year = 2000; year < 2100; year++) {
|
|
44
|
-
for (let month = 1; month <= 12; month++) {
|
|
45
|
-
if (DD <= bs[year][month]) {
|
|
46
|
-
nepaliYear = year;
|
|
47
|
-
nepaliMonth = month;
|
|
48
|
-
nepaliDay = DD;
|
|
49
|
-
break outerLoop;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
DD -= bs[year][month];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return `${nepaliYear}-${String(nepaliMonth).padStart(2, '0')}-${String(nepaliDay).padStart(2, '0')}`;
|
|
57
|
-
};
|
|
58
|
-
const NepaliToday = () => {
|
|
59
|
-
const ReferenceDate = new Date('1943-04-14').getTime();
|
|
60
|
-
const TodayDate = Date.now();
|
|
61
|
-
const date = new Date(TodayDate);
|
|
62
|
-
// number of return from that reference date
|
|
63
|
-
const DateDifference = FindDateDifference(ReferenceDate, new Date(formatDate(date)).getTime());
|
|
64
|
-
let nepaliYear = 2000;
|
|
65
|
-
let nepaliMonth = 1;
|
|
66
|
-
let nepaliDay = 1;
|
|
67
|
-
//difference can calculate upto previous day so add 1 to get current day(Today)
|
|
68
|
-
let DD = DateDifference + 1;
|
|
69
|
-
outerLoop: for (let year = 2000; year < 2100; year++) {
|
|
70
|
-
for (let month = 1; month <= 12; month++) {
|
|
71
|
-
if (DD <= bs[year][month]) {
|
|
72
|
-
nepaliYear = year;
|
|
73
|
-
nepaliMonth = month;
|
|
74
|
-
nepaliDay = DD;
|
|
75
|
-
break outerLoop;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
DD -= bs[year][month];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return `${nepaliYear}-${String(nepaliMonth).padStart(2, '0')}-${String(nepaliDay).padStart(2, '0')}`;
|
|
83
|
-
// return DateDifference;
|
|
84
|
-
//add the difference between reference and today date to nepali reference date and find new today nepali date
|
|
85
|
-
};
|
|
86
|
-
const BsToAd = (userDate) => {
|
|
87
|
-
try {
|
|
88
|
-
const dateArray = userDate.split('-');
|
|
89
|
-
let dateDifference = 0;
|
|
90
|
-
if (dateArray.length !== 3) {
|
|
91
|
-
throw new Error('Invalid date format');
|
|
92
|
-
}
|
|
93
|
-
const [userYear, userMonth, userDay] = dateArray.map(Number);
|
|
94
|
-
if (userYear < 2000 || userYear >= 2100) {
|
|
95
|
-
throw new Error('Year Range is 2000 to 2099');
|
|
96
|
-
}
|
|
97
|
-
if (userMonth < 1 || userMonth > 12) {
|
|
98
|
-
throw new Error('Month Range is 1 to 12');
|
|
99
|
-
}
|
|
100
|
-
// if (userMonth < 1 || userMonth > 31) {
|
|
101
|
-
// throw new Error('Month out of supported range');
|
|
102
|
-
// }
|
|
103
|
-
for (let year = 2000; year < userYear; year++) {
|
|
104
|
-
for (let month = 1; month <= 12; month++) {
|
|
105
|
-
dateDifference += bs[year][month];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
for (let month = 1; month < userMonth; month++) {
|
|
109
|
-
dateDifference += bs[userYear][month];
|
|
110
|
-
}
|
|
111
|
-
dateDifference += userDay - 1;
|
|
112
|
-
const referenceDate = new Date('1943-04-14');
|
|
113
|
-
const futureDate = new Date(referenceDate);
|
|
114
|
-
futureDate.setDate(referenceDate.getDate() + dateDifference);
|
|
115
|
-
return futureDate.toISOString().split('T')[0];
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
return ' Year Range is 2000 to 2099';
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
export { AdToBs, BsToAd, formatDate, FindDateDifference, NepaliToday };
|
package/src/calendar/settings.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { bs, leapYears } from './config';
|
|
2
|
-
const calcFirstDay = (currentYear, currentMonth) => {
|
|
3
|
-
let month = currentMonth;
|
|
4
|
-
let year = currentYear;
|
|
5
|
-
const diff = year - 2000;
|
|
6
|
-
let leapYear = 0;
|
|
7
|
-
let firstDay;
|
|
8
|
-
for (let l = 0; l < leapYears.length; l++) {
|
|
9
|
-
if (year > leapYears[l]) {
|
|
10
|
-
leapYear++;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
// if (year > 2096) {
|
|
14
|
-
// leapYear--;
|
|
15
|
-
// }
|
|
16
|
-
//calculate number of days since the first refernce year i.e 2081
|
|
17
|
-
let td = 3 + diff * 365 + leapYear;
|
|
18
|
-
if (month - 1 > 0) {
|
|
19
|
-
for (let i = 1; i < month; i++) {
|
|
20
|
-
td += bs[year][i];
|
|
21
|
-
}
|
|
22
|
-
firstDay = td % 7;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
firstDay = td % 7;
|
|
26
|
-
}
|
|
27
|
-
td = 0;
|
|
28
|
-
return firstDay;
|
|
29
|
-
};
|
|
30
|
-
const isToday = (date, index, currentYear, currentMonth, firstDayOfMonth) => {
|
|
31
|
-
return (parseInt(date.split('-')[2], 10) - 1 + firstDayOfMonth === index &&
|
|
32
|
-
currentMonth === parseInt(date.slice(5, 7), 10) &&
|
|
33
|
-
currentYear === parseInt(date.slice(0, 4), 10));
|
|
34
|
-
};
|
|
35
|
-
export { calcFirstDay, isToday };
|
package/src/index.js
DELETED
package/src/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|