ngx-np-datepicker 2.3.1 → 2.3.3

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.
@@ -5,114 +5,119 @@ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
5
  import * as i2 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
7
7
 
8
+ const NP_DATE = Object.freeze({
9
+ englishMonths: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
10
+ englishLeapMonths: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
11
+ nepaliMonths: [
12
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
13
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
14
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
15
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
16
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
17
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
18
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
19
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
20
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
21
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
22
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
23
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
24
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
25
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
26
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
27
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
28
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
29
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
30
+ [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
31
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
32
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
33
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
34
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
35
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
36
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
37
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
38
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
39
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
40
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
41
+ [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],
42
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
43
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
44
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
45
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
46
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
47
+ [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
48
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
49
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
50
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
51
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
52
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
53
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
54
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
55
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
56
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
57
+ [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
58
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
59
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
60
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
61
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
62
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
63
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
64
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
65
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
66
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
67
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
68
+ [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],
69
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
70
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
71
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
72
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
73
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
74
+ [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31],
75
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
76
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
77
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
78
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
79
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
80
+ [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
81
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
82
+ [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
83
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
84
+ [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
85
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
86
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
87
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
88
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
89
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
90
+ [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
91
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
92
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
93
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
94
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
95
+ [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
96
+ [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
97
+ [31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30],
98
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
99
+ [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],
100
+ [30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30],
101
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
102
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
103
+ [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],
104
+ [30, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30],
105
+ [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
106
+ [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
107
+ [31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30],
108
+ [30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
109
+ [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
110
+ [31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 29, 31],
111
+ [31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30], //2099
112
+ ]
113
+ });
114
+
8
115
  class NpDatePickerService {
9
116
  constructor() {
10
- this.englishMonths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
11
- this.englishLeapMonths = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
12
- this.nepaliMonths = [
13
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
14
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
15
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
16
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
17
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
18
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
19
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
20
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
21
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
22
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
23
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
24
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
25
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
26
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
27
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
28
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
29
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
30
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
31
- [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
32
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
33
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
34
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
35
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
36
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
37
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
38
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
39
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
40
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
41
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
42
- [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],
43
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
44
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
45
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
46
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
47
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
48
- [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
49
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
50
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
51
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
52
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
53
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
54
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
55
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
56
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
57
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
58
- [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
59
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
60
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
61
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
62
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
63
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
64
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
65
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
66
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
67
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
68
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
69
- [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],
70
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
71
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
72
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
73
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
74
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
75
- [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31],
76
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
77
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
78
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
79
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
80
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
81
- [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
82
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
83
- [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
84
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
85
- [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
86
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
87
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
88
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
89
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
90
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
91
- [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
92
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
93
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
94
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
95
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
96
- [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
97
- [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
98
- [31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30],
99
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
100
- [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],
101
- [30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30],
102
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
103
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
104
- [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],
105
- [30, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30],
106
- [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
107
- [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],
108
- [31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30],
109
- [30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
110
- [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],
111
- [31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 29, 31],
112
- [31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30], //2099
113
- ];
117
+ this.englishMonths = NP_DATE.englishMonths;
118
+ this.englishLeapMonths = NP_DATE.englishLeapMonths;
119
+ this.nepaliMonths = NP_DATE.nepaliMonths;
114
120
  this.format = '.';
115
- var d = new Date();
116
121
  }
117
122
  setCurrentNepaliDate() {
118
123
  var d = new Date();
@@ -155,7 +160,48 @@ class NpDatePickerService {
155
160
  return {
156
161
  day: this.nepaliDate,
157
162
  month: this.nepaliMonth,
158
- year: this.nepaliYear
163
+ year: this.nepaliYear,
164
+ };
165
+ }
166
+ //ISO format English string date (YYYY-MM-DD) to Nepali date conversion
167
+ engStringToNepDate(engDate) {
168
+ const [year, month, day] = engDate.split('-').map(Number);
169
+ if (!this.isEnglishRange(day, month, year))
170
+ console.log('Invalid date format.');
171
+ this.englishYear = year;
172
+ this.englishMonth = month;
173
+ this.englishDate = day;
174
+ //Setting nepali reference to 2000/1/1 with english date 1943/4/14
175
+ this.nepaliYear = 2000;
176
+ this.nepaliMonth = 1;
177
+ this.nepaliDate = 1;
178
+ var difference = this.getEnglishDateDifference(1943, 4, 14);
179
+ //Getting nepali year untill the difference remains less than 365
180
+ var index = 0;
181
+ while (difference >= this.nepaliYearDays(index)) {
182
+ this.nepaliYear++;
183
+ difference = difference - this.nepaliYearDays(index);
184
+ index++;
185
+ //console.log('Difference:'+difference+ 'nepaliYearDays:'+this.nepaliYearDays(index));
186
+ }
187
+ //console.log("nepaliMonths="+this.nepaliMonths[index][0]+"difference:"+difference);
188
+ //Getting nepali month untill the difference remains less than 31
189
+ var i = 0;
190
+ while (difference >= this.nepaliMonths[index][i]) {
191
+ difference = difference - this.nepaliMonths[index][i];
192
+ this.nepaliMonth++;
193
+ i++;
194
+ //console.log("nepaliMonths="+this.nepaliMonths[index][i]+"difference:"+difference);
195
+ }
196
+ this.nepaliMonth--;
197
+ //console.log(difference);
198
+ //Remaning days is the date;
199
+ this.nepaliDate = this.nepaliDate + difference;
200
+ this.getDay();
201
+ return {
202
+ day: this.nepaliDate,
203
+ month: this.nepaliMonth,
204
+ year: this.nepaliYear,
159
205
  };
160
206
  }
161
207
  toEnglishString(format) {
@@ -301,7 +347,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
301
347
  args: [{
302
348
  providedIn: 'root',
303
349
  }]
304
- }], ctorParameters: function () { return []; } });
350
+ }] });
305
351
 
306
352
  const numberMapping = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];
307
353
  const wordsMapping = {
@@ -410,7 +456,7 @@ class NpDatePickerComponent {
410
456
  this.dayDisplayType = 'short';
411
457
  this.dateFormatter = (selectedDate) => {
412
458
  const dd = selectedDate.day < 10 ? '0' + selectedDate.day : selectedDate.day;
413
- const mm = selectedDate.month < 10
459
+ const mm = selectedDate.month + 1 < 10
414
460
  ? '0' + (selectedDate.month + 1)
415
461
  : selectedDate.month + 1;
416
462
  switch (this.format) {
@@ -494,14 +540,6 @@ class NpDatePickerComponent {
494
540
  registerOnChange(fn) {
495
541
  this.propagateChange = fn;
496
542
  }
497
- selectToday() {
498
- const EnglistDateToday = new Date();
499
- this.currentNepaliDate = this._nepaliDate.engToNepDate(EnglistDateToday.getDate(), EnglistDateToday.getMonth(), EnglistDateToday.getFullYear());
500
- this.selectedDate = { ...this.currentNepaliDate };
501
- this.formatValue();
502
- this.close();
503
- this.propagateChange(this.selectedDate);
504
- }
505
543
  setCurrentDate() {
506
544
  if (!this.selectedDate) {
507
545
  this.currentNepaliDate = this._nepaliDate.engToNepDate(this.currentDate.getDate(), this.currentDate.getMonth(), this.currentDate.getFullYear());
@@ -569,6 +607,14 @@ class NpDatePickerComponent {
569
607
  }
570
608
  }
571
609
  }
610
+ selectToday() {
611
+ const EnglistDateToday = new Date();
612
+ this.currentNepaliDate = this._nepaliDate.engToNepDate(EnglistDateToday.getDate(), EnglistDateToday.getMonth(), EnglistDateToday.getFullYear());
613
+ this.selectedDate = { ...this.currentNepaliDate };
614
+ this.formatValue();
615
+ this.close();
616
+ this.propagateChange(this.selectedDate);
617
+ }
572
618
  selectDate(day) {
573
619
  this.selectedDate = { ...this.currentNepaliDate, day };
574
620
  this.formatValue();
@@ -627,7 +673,7 @@ NpDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
627
673
  useExisting: forwardRef(() => NpDatePickerComponent),
628
674
  multi: true,
629
675
  },
630
- ], ngImport: i0, template: "<div class=\"nepali-date-picker\" [ngClass]=\"theme\">\r\n <input\r\n class=\"np_datepicker_input\"\r\n type=\"text\"\r\n [value]=\"formattedDate\"\r\n (focus)=\"open()\"\r\n (keydown)=\"$event.preventDefault()\"\r\n aria-hidden=\"true\"\r\n placeholder=\"yyyy/mm/dd\"\r\n />\r\n <a\r\n class=\"form-icon\"\r\n (click)=\"toggleOpen()\"\r\n [ngClass]=\"isOpen ? 'active' : ''\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z\"\r\n />\r\n </svg>\r\n </a>\r\n <ng-container [ngTemplateOutlet]=\"dp\" *ngIf=\"isOpen\"></ng-container>\r\n</div>\r\n<!--.nepali-date-picker-->\r\n\r\n<ng-template #dp>\r\n <div class=\"datepicker__container\">\r\n <div class=\"datepicker__options-container\">\r\n <a class=\"prev-month\" (click)=\"prevMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M224 480c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25l192-192c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l169.4 169.4c12.5 12.5 12.5 32.75 0 45.25C240.4 476.9 232.2 480 224 480z\"\r\n />\r\n </svg>\r\n </a>\r\n <a class=\"select-today\" (click)=\"selectToday()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-home\"><path d=\"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path><polyline points=\"9 22 9 12 15 12 15 22\"></polyline></svg>\r\n </a>\r\n <span class=\"datepicker__options-month-container\">\r\n \r\n <select (change)=\"selectMonth($event)\">\r\n <option\r\n *ngFor=\"\r\n let month of monthsMapping[language][monthDisplayType];\r\n index as i\r\n \"\r\n [value]=\"month\"\r\n [selected]=\"i === currentNepaliDate?.month\"\r\n >\r\n {{ month }}\r\n </option>\r\n </select>\r\n </span>\r\n <span class=\"datepicker__options-year-container\">\r\n \r\n <select (change)=\"selectYear($event)\">\r\n <option\r\n *ngFor=\"let year of years; index as i\"\r\n [value]=\"year\"\r\n [selected]=\"year == currentNepaliDate?.year\"\r\n >\r\n {{ year | toNp: language:\"number\" }}\r\n </option>\r\n </select>\r\n </span>\r\n \r\n <a class=\"next-month\" (click)=\"nextMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z\"\r\n />\r\n </svg>\r\n </a>\r\n </div>\r\n <div class=\"datepicker__days-container\">\r\n <div\r\n class=\"datepicker__days\"\r\n *ngFor=\"let day of daysMapping[language][dayDisplayType]; index as i\"\r\n >\r\n <div class=\"datepicker__weekday\">{{ day }}</div>\r\n <div\r\n class=\"datepicker__date-container\"\r\n *ngFor=\"let date of currentMonthData[i]\"\r\n >\r\n <div *ngIf=\"hasFuture; else noFutureDate\">\r\n <div\r\n *ngIf=\"date\"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </div>\r\n\r\n <ng-template #noFutureDate>\r\n <div\r\n *ngIf=\"\r\n date &&\r\n this.currentNepaliDate.year * 365 +\r\n this.currentNepaliDate.month * 30 +\r\n date <=\r\n nepaliDateToday.day +\r\n nepaliDateToday.month * 30 +\r\n nepaliDateToday.year * 365;\r\n else disabledDates\r\n \"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n\r\n <ng-template #disabledDates>\r\n <div class=\"datepicker__date datepicker__date--disabled\">\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n </ng-template>\r\n\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <!--.datepicker__date-container ends-->\r\n </div>\r\n <!--.datepicker__days ends-->\r\n </div>\r\n <!--.datepicker__days-container ends-->\r\n </div>\r\n <!--.datepicker__container ends-->\r\n</ng-template>\r\n", styles: [".nepali-date-picker.nepali-date-picker{position:relative;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:1em}.nepali-date-picker a.active svg{fill:#e45415;opacity:.9}.nepali-date-picker .form-icon svg{width:14px;opacity:.3;position:absolute;right:8px;top:12px;cursor:pointer}.datepicker__container{border:1px solid #eee;background:#fff;width:294px;box-shadow:#0a0a0f33 0 7px 29px;position:absolute;z-index:99999}.datepicker__options-container{padding:12px 5px;border-bottom:1px solid #eee;display:flex;justify-content:space-evenly;background-color:#e45415;color:#fff;line-height:25px;font-size:1em}.datepicker__days-container{display:flex;justify-content:center;color:#777}.datepicker__days{text-align:center;padding-bottom:10px}.datepicker__weekday{padding:8px;font-weight:700;border-bottom:1px solid #eee;margin-bottom:14px}.datepicker__date-container{width:40px;height:40px;line-height:40px;margin:8px 0}.datepicker__date-container>div{height:100%}.datepicker__date{cursor:pointer;border-radius:4px}.datepicker__date:hover{background-color:#eee}.datepicker__date.datepicker__date--disabled{background:#f3f3f3;border-radius:0}.datepicker__date.datepicker__date--disabled:hover{background:#f3f3f3}.datepicker__date--active.datepicker__date--active{background-color:#e45415;color:#fff}select:focus,select:focus-visible{outline:1px solid #fff}.datepicker__container select{border:none;color:#fff;background:none;font-size:inherit}select option{color:#333}.np_datepicker_input{border:1px solid #eee;padding:10px;font-size:16px;color:#777}.np_datepicker_input:focus-visible{outline:2px solid #e45415}.prev-month,.next-month{padding:0;width:25px;height:25px;display:block;opacity:.5;border-radius:50%;background:#f3f3f3;cursor:pointer;text-align:center;line-height:23px}.next-month:hover,.prev-month:hover{background:#ccc}.prev-month svg,.next-month svg{max-width:8px;height:auto}.select-today{padding:0;width:22px;height:22px;display:block;cursor:pointer;color:#ffffffe6;text-align:center;line-height:23px}.select-today:hover{color:#ffffff80}.select-today svg{max-width:100%}.dark.nepali-date-picker a.active svg{fill:#000}.dark .datepicker__options-container{border-bottom:1px solid #000;background-color:#000;color:#fff}.dark .datepicker__container{background:#333}.dark select{color:#fff}.datepicker__date--current-day{background-color:#f3f3f3;border:2px dashed rgba(0,0,0,.2);position:relative;z-index:999;height:100%}.dark .datepicker__date--active.datepicker__date--active{background-color:#000;color:#fff}.dark .np_datepicker_input:focus-visible{outline:2px solid #000}.dark .datepicker__days{background-color:#333}.dark .datepicker__date:hover{background-color:#222;color:#fff}.dark .datepicker__days-container{color:#aaa}.dark .datepicker__weekday{border-bottom:1px solid #555}.dark .datepicker__date--current-day{background:#555;border:none}.light.nepali-date-picker a.active svg{fill:#777}.light .datepicker__options-container{border-bottom:none;background-color:#fff;color:#777}.light select{color:#777}.light .datepicker__date--active.datepicker__date--active{background-color:#aaa;color:#fff}.light .np_datepicker_input:focus-visible{outline:1px solid #ddd}.lightblue.nepali-date-picker a.active svg{fill:#38c5f0da}.lightblue .datepicker__options-container{background-color:#38c5f0da;color:#fff}.lightblue select{color:#fff}.lightblue .datepicker__date--active.datepicker__date--active{background-color:#38c5f0da;color:#fff}.lightblue .np_datepicker_input:focus-visible{outline:2px solid #38c5f0da}.lightblue .np_datepicker_input:focus-visible{outline:1px solid #38c5f0da}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], pipes: { "toNp": ToNpPipe }, encapsulation: i0.ViewEncapsulation.None });
676
+ ], ngImport: i0, template: "<div class=\"nepali-date-picker\" [ngClass]=\"theme\">\r\n <input\r\n class=\"ngx_np_datepicker_input\"\r\n type=\"text\"\r\n [value]=\"formattedDate\"\r\n (focus)=\"open()\"\r\n (keydown)=\"$event.preventDefault()\"\r\n aria-hidden=\"true\"\r\n placeholder=\"yyyy/mm/dd\"\r\n />\r\n <a\r\n class=\"form-icon\"\r\n (click)=\"toggleOpen()\"\r\n [ngClass]=\"isOpen ? 'active' : ''\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z\"\r\n />\r\n </svg>\r\n </a>\r\n <ng-container [ngTemplateOutlet]=\"npdp\" *ngIf=\"isOpen\"></ng-container>\r\n</div>\r\n<ng-template #npdp>\r\n <div class=\"datepicker__container\">\r\n <div class=\"datepicker__options-container\">\r\n <a class=\"prev-month\" (click)=\"prevMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M224 480c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25l192-192c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l169.4 169.4c12.5 12.5 12.5 32.75 0 45.25C240.4 476.9 232.2 480 224 480z\"\r\n />\r\n </svg>\r\n </a>\r\n <a class=\"select-today\" (click)=\"selectToday()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-home\"><path d=\"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path><polyline points=\"9 22 9 12 15 12 15 22\"></polyline></svg>\r\n </a>\r\n <span class=\"datepicker__options-month-container\">\r\n \r\n <select (change)=\"selectMonth($event)\">\r\n <option\r\n *ngFor=\"\r\n let month of monthsMapping[language][monthDisplayType];\r\n index as i\r\n \"\r\n [value]=\"month\"\r\n [selected]=\"i === currentNepaliDate?.month\"\r\n >\r\n {{ month }}\r\n </option>\r\n </select>\r\n </span>\r\n <span class=\"datepicker__options-year-container\">\r\n \r\n <select (change)=\"selectYear($event)\">\r\n <option\r\n *ngFor=\"let year of years; index as i\"\r\n [value]=\"year\"\r\n [selected]=\"year == currentNepaliDate?.year\"\r\n >\r\n {{ year | toNp: language:\"number\" }}\r\n </option>\r\n </select>\r\n </span>\r\n \r\n <a class=\"next-month\" (click)=\"nextMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z\"\r\n />\r\n </svg>\r\n </a>\r\n </div>\r\n <div class=\"datepicker__days-container\">\r\n <div\r\n class=\"datepicker__days\"\r\n *ngFor=\"let day of daysMapping[language][dayDisplayType]; index as i\"\r\n >\r\n <div class=\"datepicker__weekday\">{{ day }}</div>\r\n <div\r\n class=\"datepicker__date-container\"\r\n *ngFor=\"let date of currentMonthData[i]\"\r\n >\r\n <div *ngIf=\"hasFuture; else noFutureDate\">\r\n <div\r\n *ngIf=\"date\"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </div>\r\n\r\n <ng-template #noFutureDate>\r\n <div\r\n *ngIf=\"\r\n date &&\r\n this.currentNepaliDate.year * 365 +\r\n this.currentNepaliDate.month * 30 +\r\n date <=\r\n nepaliDateToday.day +\r\n nepaliDateToday.month * 30 +\r\n nepaliDateToday.year * 365;\r\n else disabledDates\r\n \"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n\r\n <ng-template #disabledDates>\r\n <div class=\"datepicker__date datepicker__date--disabled\">\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n </ng-template>\r\n\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <!--.datepicker__date-container ends-->\r\n </div>\r\n <!--.datepicker__days ends-->\r\n </div>\r\n <!--.datepicker__days-container ends-->\r\n </div>\r\n <!--.datepicker__container ends-->\r\n</ng-template>\r\n", styles: [".nepali-date-picker.nepali-date-picker{position:relative;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:1em}.nepali-date-picker a.active svg{fill:#337ab7;opacity:.9}.nepali-date-picker .form-icon svg{width:14px;opacity:.3;position:absolute;right:8px;top:12px;cursor:pointer}.datepicker__container{border:1px solid #eee;background:#fff;width:294px;box-shadow:#0a0a0f33 0 7px 29px;position:absolute;z-index:99999}.datepicker__options-container{padding:12px 5px;border-bottom:1px solid #eee;display:flex;justify-content:space-evenly;background-color:#337ab7;color:#fff;line-height:25px;font-size:1em}.datepicker__days-container{display:flex;justify-content:center;color:#777}.datepicker__days{text-align:center;padding-bottom:10px}.datepicker__weekday{padding:8px;font-weight:700;border-bottom:1px solid #eee;margin-bottom:14px}.datepicker__date-container{width:40px;height:40px;line-height:40px;margin:8px 0}.datepicker__date-container>div{height:100%}.datepicker__date{cursor:pointer;border-radius:4px}.datepicker__date:hover{background-color:#eee}.datepicker__date.datepicker__date--disabled{background:#f3f3f3;border-radius:0}.datepicker__date.datepicker__date--disabled:hover{background:#f3f3f3}.datepicker__date--active.datepicker__date--active{background-color:#337ab7;color:#fff}select:focus,select:focus-visible{outline:1px solid #fff}.datepicker__container select{border:none;color:#fff;background:none;font-size:inherit}select option{color:#333}.ngx_np_datepicker_input{border:1px solid #eee;padding:10px;font-size:16px;color:#777}.ngx_np_datepicker_input:focus-visible{outline:2px solid #337ab7}.prev-month,.next-month{padding:0;width:25px;height:25px;display:block;opacity:.5;border-radius:50%;background:#f3f3f3;cursor:pointer;text-align:center;line-height:23px}.next-month:hover,.prev-month:hover{background:#ccc}.prev-month svg,.next-month svg{max-width:8px;height:auto}.select-today{padding:0;width:22px;height:22px;display:block;cursor:pointer;color:#ffffffe6;text-align:center;line-height:23px}.select-today:hover{color:#ffffff80}.select-today svg{max-width:100%}.dark.nepali-date-picker a.active svg{fill:#000}.dark .datepicker__options-container{border-bottom:1px solid #000;background-color:#000;color:#fff}.dark .datepicker__container{background:#333}.dark select{color:#fff}.datepicker__date--current-day{background-color:#f3f3f3;border:2px dashed rgba(0,0,0,.2);position:relative;z-index:999;height:100%}.dark .datepicker__date--active.datepicker__date--active{background-color:#000;color:#fff}.dark .ngx_np_datepicker_input:focus-visible{outline:2px solid #000}.dark .datepicker__days{background-color:#333}.dark .datepicker__date:hover{background-color:#222;color:#fff}.dark .datepicker__days-container{color:#aaa}.dark .datepicker__weekday{border-bottom:1px solid #555}.dark .datepicker__date--current-day{background:#555;border:none}.light.nepali-date-picker a.active svg{fill:#777}.light .datepicker__options-container{border-bottom:none;background-color:#fff;color:#777}.light select{color:#777}.light .datepicker__date--active.datepicker__date--active{background-color:#aaa;color:#fff}.light .ngx_np_datepicker_input:focus-visible{outline:1px solid #ddd}.lightblue.nepali-date-picker a.active svg{fill:#38c5f0da}.lightblue .datepicker__options-container{background-color:#38c5f0da;color:#fff}.lightblue select{color:#fff}.lightblue .datepicker__date--active.datepicker__date--active{background-color:#38c5f0da;color:#fff}.lightblue .ngx_np_datepicker_input:focus-visible{outline:2px solid #38c5f0da}.lightblue .ngx_np_datepicker_input:focus-visible{outline:1px solid #38c5f0da}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], pipes: { "toNp": ToNpPipe }, encapsulation: i0.ViewEncapsulation.None });
631
677
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: NpDatePickerComponent, decorators: [{
632
678
  type: Component,
633
679
  args: [{ selector: 'np-datepicker', providers: [
@@ -636,7 +682,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
636
682
  useExisting: forwardRef(() => NpDatePickerComponent),
637
683
  multi: true,
638
684
  },
639
- ], encapsulation: ViewEncapsulation.None, template: "<div class=\"nepali-date-picker\" [ngClass]=\"theme\">\r\n <input\r\n class=\"np_datepicker_input\"\r\n type=\"text\"\r\n [value]=\"formattedDate\"\r\n (focus)=\"open()\"\r\n (keydown)=\"$event.preventDefault()\"\r\n aria-hidden=\"true\"\r\n placeholder=\"yyyy/mm/dd\"\r\n />\r\n <a\r\n class=\"form-icon\"\r\n (click)=\"toggleOpen()\"\r\n [ngClass]=\"isOpen ? 'active' : ''\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z\"\r\n />\r\n </svg>\r\n </a>\r\n <ng-container [ngTemplateOutlet]=\"dp\" *ngIf=\"isOpen\"></ng-container>\r\n</div>\r\n<!--.nepali-date-picker-->\r\n\r\n<ng-template #dp>\r\n <div class=\"datepicker__container\">\r\n <div class=\"datepicker__options-container\">\r\n <a class=\"prev-month\" (click)=\"prevMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M224 480c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25l192-192c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l169.4 169.4c12.5 12.5 12.5 32.75 0 45.25C240.4 476.9 232.2 480 224 480z\"\r\n />\r\n </svg>\r\n </a>\r\n <a class=\"select-today\" (click)=\"selectToday()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-home\"><path d=\"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path><polyline points=\"9 22 9 12 15 12 15 22\"></polyline></svg>\r\n </a>\r\n <span class=\"datepicker__options-month-container\">\r\n \r\n <select (change)=\"selectMonth($event)\">\r\n <option\r\n *ngFor=\"\r\n let month of monthsMapping[language][monthDisplayType];\r\n index as i\r\n \"\r\n [value]=\"month\"\r\n [selected]=\"i === currentNepaliDate?.month\"\r\n >\r\n {{ month }}\r\n </option>\r\n </select>\r\n </span>\r\n <span class=\"datepicker__options-year-container\">\r\n \r\n <select (change)=\"selectYear($event)\">\r\n <option\r\n *ngFor=\"let year of years; index as i\"\r\n [value]=\"year\"\r\n [selected]=\"year == currentNepaliDate?.year\"\r\n >\r\n {{ year | toNp: language:\"number\" }}\r\n </option>\r\n </select>\r\n </span>\r\n \r\n <a class=\"next-month\" (click)=\"nextMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z\"\r\n />\r\n </svg>\r\n </a>\r\n </div>\r\n <div class=\"datepicker__days-container\">\r\n <div\r\n class=\"datepicker__days\"\r\n *ngFor=\"let day of daysMapping[language][dayDisplayType]; index as i\"\r\n >\r\n <div class=\"datepicker__weekday\">{{ day }}</div>\r\n <div\r\n class=\"datepicker__date-container\"\r\n *ngFor=\"let date of currentMonthData[i]\"\r\n >\r\n <div *ngIf=\"hasFuture; else noFutureDate\">\r\n <div\r\n *ngIf=\"date\"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </div>\r\n\r\n <ng-template #noFutureDate>\r\n <div\r\n *ngIf=\"\r\n date &&\r\n this.currentNepaliDate.year * 365 +\r\n this.currentNepaliDate.month * 30 +\r\n date <=\r\n nepaliDateToday.day +\r\n nepaliDateToday.month * 30 +\r\n nepaliDateToday.year * 365;\r\n else disabledDates\r\n \"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n\r\n <ng-template #disabledDates>\r\n <div class=\"datepicker__date datepicker__date--disabled\">\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n </ng-template>\r\n\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <!--.datepicker__date-container ends-->\r\n </div>\r\n <!--.datepicker__days ends-->\r\n </div>\r\n <!--.datepicker__days-container ends-->\r\n </div>\r\n <!--.datepicker__container ends-->\r\n</ng-template>\r\n", styles: [".nepali-date-picker.nepali-date-picker{position:relative;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:1em}.nepali-date-picker a.active svg{fill:#e45415;opacity:.9}.nepali-date-picker .form-icon svg{width:14px;opacity:.3;position:absolute;right:8px;top:12px;cursor:pointer}.datepicker__container{border:1px solid #eee;background:#fff;width:294px;box-shadow:#0a0a0f33 0 7px 29px;position:absolute;z-index:99999}.datepicker__options-container{padding:12px 5px;border-bottom:1px solid #eee;display:flex;justify-content:space-evenly;background-color:#e45415;color:#fff;line-height:25px;font-size:1em}.datepicker__days-container{display:flex;justify-content:center;color:#777}.datepicker__days{text-align:center;padding-bottom:10px}.datepicker__weekday{padding:8px;font-weight:700;border-bottom:1px solid #eee;margin-bottom:14px}.datepicker__date-container{width:40px;height:40px;line-height:40px;margin:8px 0}.datepicker__date-container>div{height:100%}.datepicker__date{cursor:pointer;border-radius:4px}.datepicker__date:hover{background-color:#eee}.datepicker__date.datepicker__date--disabled{background:#f3f3f3;border-radius:0}.datepicker__date.datepicker__date--disabled:hover{background:#f3f3f3}.datepicker__date--active.datepicker__date--active{background-color:#e45415;color:#fff}select:focus,select:focus-visible{outline:1px solid #fff}.datepicker__container select{border:none;color:#fff;background:none;font-size:inherit}select option{color:#333}.np_datepicker_input{border:1px solid #eee;padding:10px;font-size:16px;color:#777}.np_datepicker_input:focus-visible{outline:2px solid #e45415}.prev-month,.next-month{padding:0;width:25px;height:25px;display:block;opacity:.5;border-radius:50%;background:#f3f3f3;cursor:pointer;text-align:center;line-height:23px}.next-month:hover,.prev-month:hover{background:#ccc}.prev-month svg,.next-month svg{max-width:8px;height:auto}.select-today{padding:0;width:22px;height:22px;display:block;cursor:pointer;color:#ffffffe6;text-align:center;line-height:23px}.select-today:hover{color:#ffffff80}.select-today svg{max-width:100%}.dark.nepali-date-picker a.active svg{fill:#000}.dark .datepicker__options-container{border-bottom:1px solid #000;background-color:#000;color:#fff}.dark .datepicker__container{background:#333}.dark select{color:#fff}.datepicker__date--current-day{background-color:#f3f3f3;border:2px dashed rgba(0,0,0,.2);position:relative;z-index:999;height:100%}.dark .datepicker__date--active.datepicker__date--active{background-color:#000;color:#fff}.dark .np_datepicker_input:focus-visible{outline:2px solid #000}.dark .datepicker__days{background-color:#333}.dark .datepicker__date:hover{background-color:#222;color:#fff}.dark .datepicker__days-container{color:#aaa}.dark .datepicker__weekday{border-bottom:1px solid #555}.dark .datepicker__date--current-day{background:#555;border:none}.light.nepali-date-picker a.active svg{fill:#777}.light .datepicker__options-container{border-bottom:none;background-color:#fff;color:#777}.light select{color:#777}.light .datepicker__date--active.datepicker__date--active{background-color:#aaa;color:#fff}.light .np_datepicker_input:focus-visible{outline:1px solid #ddd}.lightblue.nepali-date-picker a.active svg{fill:#38c5f0da}.lightblue .datepicker__options-container{background-color:#38c5f0da;color:#fff}.lightblue select{color:#fff}.lightblue .datepicker__date--active.datepicker__date--active{background-color:#38c5f0da;color:#fff}.lightblue .np_datepicker_input:focus-visible{outline:2px solid #38c5f0da}.lightblue .np_datepicker_input:focus-visible{outline:1px solid #38c5f0da}\n"] }]
685
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"nepali-date-picker\" [ngClass]=\"theme\">\r\n <input\r\n class=\"ngx_np_datepicker_input\"\r\n type=\"text\"\r\n [value]=\"formattedDate\"\r\n (focus)=\"open()\"\r\n (keydown)=\"$event.preventDefault()\"\r\n aria-hidden=\"true\"\r\n placeholder=\"yyyy/mm/dd\"\r\n />\r\n <a\r\n class=\"form-icon\"\r\n (click)=\"toggleOpen()\"\r\n [ngClass]=\"isOpen ? 'active' : ''\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z\"\r\n />\r\n </svg>\r\n </a>\r\n <ng-container [ngTemplateOutlet]=\"npdp\" *ngIf=\"isOpen\"></ng-container>\r\n</div>\r\n<ng-template #npdp>\r\n <div class=\"datepicker__container\">\r\n <div class=\"datepicker__options-container\">\r\n <a class=\"prev-month\" (click)=\"prevMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M224 480c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25l192-192c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l169.4 169.4c12.5 12.5 12.5 32.75 0 45.25C240.4 476.9 232.2 480 224 480z\"\r\n />\r\n </svg>\r\n </a>\r\n <a class=\"select-today\" (click)=\"selectToday()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-home\"><path d=\"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path><polyline points=\"9 22 9 12 15 12 15 22\"></polyline></svg>\r\n </a>\r\n <span class=\"datepicker__options-month-container\">\r\n \r\n <select (change)=\"selectMonth($event)\">\r\n <option\r\n *ngFor=\"\r\n let month of monthsMapping[language][monthDisplayType];\r\n index as i\r\n \"\r\n [value]=\"month\"\r\n [selected]=\"i === currentNepaliDate?.month\"\r\n >\r\n {{ month }}\r\n </option>\r\n </select>\r\n </span>\r\n <span class=\"datepicker__options-year-container\">\r\n \r\n <select (change)=\"selectYear($event)\">\r\n <option\r\n *ngFor=\"let year of years; index as i\"\r\n [value]=\"year\"\r\n [selected]=\"year == currentNepaliDate?.year\"\r\n >\r\n {{ year | toNp: language:\"number\" }}\r\n </option>\r\n </select>\r\n </span>\r\n \r\n <a class=\"next-month\" (click)=\"nextMonth()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\r\n <path\r\n d=\"M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z\"\r\n />\r\n </svg>\r\n </a>\r\n </div>\r\n <div class=\"datepicker__days-container\">\r\n <div\r\n class=\"datepicker__days\"\r\n *ngFor=\"let day of daysMapping[language][dayDisplayType]; index as i\"\r\n >\r\n <div class=\"datepicker__weekday\">{{ day }}</div>\r\n <div\r\n class=\"datepicker__date-container\"\r\n *ngFor=\"let date of currentMonthData[i]\"\r\n >\r\n <div *ngIf=\"hasFuture; else noFutureDate\">\r\n <div\r\n *ngIf=\"date\"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </div>\r\n\r\n <ng-template #noFutureDate>\r\n <div\r\n *ngIf=\"\r\n date &&\r\n this.currentNepaliDate.year * 365 +\r\n this.currentNepaliDate.month * 30 +\r\n date <=\r\n nepaliDateToday.day +\r\n nepaliDateToday.month * 30 +\r\n nepaliDateToday.year * 365;\r\n else disabledDates\r\n \"\r\n class=\"datepicker__date\"\r\n [class.datepicker__date--active]=\"\r\n date === selectedDate?.day &&\r\n currentNepaliDate.month === selectedDate?.month &&\r\n currentNepaliDate.year === selectedDate?.year\r\n \"\r\n [class.datepicker__date--current-day]=\"\r\n date === nepaliDateToday.day &&\r\n currentNepaliDate.month === nepaliDateToday.month &&\r\n currentNepaliDate.year === nepaliDateToday.year\r\n \"\r\n (click)=\"selectDate(date)\"\r\n >\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n\r\n <ng-template #disabledDates>\r\n <div class=\"datepicker__date datepicker__date--disabled\">\r\n {{ date | toNp: language:\"number\" }}\r\n </div>\r\n </ng-template>\r\n\r\n <div *ngIf=\"!date\" class=\"datepicker__date--disabled\">\r\n <span>&nbsp;</span>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <!--.datepicker__date-container ends-->\r\n </div>\r\n <!--.datepicker__days ends-->\r\n </div>\r\n <!--.datepicker__days-container ends-->\r\n </div>\r\n <!--.datepicker__container ends-->\r\n</ng-template>\r\n", styles: [".nepali-date-picker.nepali-date-picker{position:relative;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:1em}.nepali-date-picker a.active svg{fill:#337ab7;opacity:.9}.nepali-date-picker .form-icon svg{width:14px;opacity:.3;position:absolute;right:8px;top:12px;cursor:pointer}.datepicker__container{border:1px solid #eee;background:#fff;width:294px;box-shadow:#0a0a0f33 0 7px 29px;position:absolute;z-index:99999}.datepicker__options-container{padding:12px 5px;border-bottom:1px solid #eee;display:flex;justify-content:space-evenly;background-color:#337ab7;color:#fff;line-height:25px;font-size:1em}.datepicker__days-container{display:flex;justify-content:center;color:#777}.datepicker__days{text-align:center;padding-bottom:10px}.datepicker__weekday{padding:8px;font-weight:700;border-bottom:1px solid #eee;margin-bottom:14px}.datepicker__date-container{width:40px;height:40px;line-height:40px;margin:8px 0}.datepicker__date-container>div{height:100%}.datepicker__date{cursor:pointer;border-radius:4px}.datepicker__date:hover{background-color:#eee}.datepicker__date.datepicker__date--disabled{background:#f3f3f3;border-radius:0}.datepicker__date.datepicker__date--disabled:hover{background:#f3f3f3}.datepicker__date--active.datepicker__date--active{background-color:#337ab7;color:#fff}select:focus,select:focus-visible{outline:1px solid #fff}.datepicker__container select{border:none;color:#fff;background:none;font-size:inherit}select option{color:#333}.ngx_np_datepicker_input{border:1px solid #eee;padding:10px;font-size:16px;color:#777}.ngx_np_datepicker_input:focus-visible{outline:2px solid #337ab7}.prev-month,.next-month{padding:0;width:25px;height:25px;display:block;opacity:.5;border-radius:50%;background:#f3f3f3;cursor:pointer;text-align:center;line-height:23px}.next-month:hover,.prev-month:hover{background:#ccc}.prev-month svg,.next-month svg{max-width:8px;height:auto}.select-today{padding:0;width:22px;height:22px;display:block;cursor:pointer;color:#ffffffe6;text-align:center;line-height:23px}.select-today:hover{color:#ffffff80}.select-today svg{max-width:100%}.dark.nepali-date-picker a.active svg{fill:#000}.dark .datepicker__options-container{border-bottom:1px solid #000;background-color:#000;color:#fff}.dark .datepicker__container{background:#333}.dark select{color:#fff}.datepicker__date--current-day{background-color:#f3f3f3;border:2px dashed rgba(0,0,0,.2);position:relative;z-index:999;height:100%}.dark .datepicker__date--active.datepicker__date--active{background-color:#000;color:#fff}.dark .ngx_np_datepicker_input:focus-visible{outline:2px solid #000}.dark .datepicker__days{background-color:#333}.dark .datepicker__date:hover{background-color:#222;color:#fff}.dark .datepicker__days-container{color:#aaa}.dark .datepicker__weekday{border-bottom:1px solid #555}.dark .datepicker__date--current-day{background:#555;border:none}.light.nepali-date-picker a.active svg{fill:#777}.light .datepicker__options-container{border-bottom:none;background-color:#fff;color:#777}.light select{color:#777}.light .datepicker__date--active.datepicker__date--active{background-color:#aaa;color:#fff}.light .ngx_np_datepicker_input:focus-visible{outline:1px solid #ddd}.lightblue.nepali-date-picker a.active svg{fill:#38c5f0da}.lightblue .datepicker__options-container{background-color:#38c5f0da;color:#fff}.lightblue select{color:#fff}.lightblue .datepicker__date--active.datepicker__date--active{background-color:#38c5f0da;color:#fff}.lightblue .ngx_np_datepicker_input:focus-visible{outline:2px solid #38c5f0da}.lightblue .ngx_np_datepicker_input:focus-visible{outline:1px solid #38c5f0da}\n"] }]
640
686
  }], ctorParameters: function () { return [{ type: NpDatePickerService }, { type: i0.ElementRef }]; }, propDecorators: { theme: [{
641
687
  type: Input
642
688
  }], language: [{