@@ -41,35 +41,151 @@ const colombianHolidays2015 = colombianHolidays(2015);
41
41
42
42
The content of the ` colombianHolidays2015 ` variable will be the following array:
43
43
44
- <!-- prettier-ignore-start -->
45
44
``` js
46
45
[
47
- { date: ' 2015-01-01' , celebrationDate: ' 2015-01-01' , name: ' Año Nuevo' , nextMonday: false },
48
- { date: ' 2015-01-06' , celebrationDate: ' 2015-01-12' , name: ' Reyes Magos' , nextMonday: true },
49
- { date: ' 2015-03-19' , celebrationDate: ' 2015-03-23' , name: ' San José' , nextMonday: true },
50
- { date: ' 2015-04-02' , celebrationDate: ' 2015-04-02' , name: ' Jueves Santo' , nextMonday: false },
51
- { date: ' 2015-04-03' , celebrationDate: ' 2015-04-03' , name: ' Viernes Santo' , nextMonday: false },
52
- { date: ' 2015-05-01' , celebrationDate: ' 2015-05-01' , name: ' Día del Trabajo' , nextMonday: false },
53
- { date: ' 2015-05-14' , celebrationDate: ' 2015-05-18' , name: ' Ascensión del Señor' , nextMonday: true },
54
- { date: ' 2015-06-04' , celebrationDate: ' 2015-06-08' , name: ' Corpus Christi' , nextMonday: true },
55
- { date: ' 2015-06-12' , celebrationDate: ' 2015-06-15' , name: ' Sagrado Corazón de Jesús' , nextMonday: true },
56
- { date: ' 2015-06-29' , celebrationDate: ' 2015-06-29' , name: ' San Pedro y San Pablo' , nextMonday: true },
57
- { date: ' 2015-07-20' , celebrationDate: ' 2015-07-20' , name: ' Grito de la Independencia' , nextMonday: false },
58
- { date: ' 2015-08-07' , celebrationDate: ' 2015-08-07' , name: ' Batalla de Boyacá' , nextMonday: false },
59
- { date: ' 2015-08-15' , celebrationDate: ' 2015-08-17' , name: ' Asunción de la Virgen' , nextMonday: true },
60
- { date: ' 2015-10-12' , celebrationDate: ' 2015-10-12' , name: ' Día de la Raza' , nextMonday: true },
61
- { date: ' 2015-11-01' , celebrationDate: ' 2015-11-02' , name: ' Todos los Santos' , nextMonday: true },
62
- { date: ' 2015-11-11' , celebrationDate: ' 2015-11-16' , name: ' Independencia de Cartagena' , nextMonday: true },
63
- { date: ' 2015-12-08' , celebrationDate: ' 2015-12-08' , name: ' Inmaculada Concepción' , nextMonday: false },
64
- { date: ' 2015-12-25' , celebrationDate: ' 2015-12-25' , name: ' Navidad' , nextMonday: false },
65
- ]
46
+ {
47
+ date: " 2015-01-01" ,
48
+ celebrationDate: " 2015-01-01" ,
49
+ name: {
50
+ es: " Año Nuevo" ,
51
+ en: " New Year's day" ,
52
+ },
53
+ nextMonday: false ,
54
+ },
55
+ {
56
+ date: " 2015-01-06" ,
57
+ celebrationDate: " 2015-01-12" ,
58
+ name: {
59
+ es: " Reyes Magos" ,
60
+ en: " Epiphany" ,
61
+ },
62
+ nextMonday: true ,
63
+ },
64
+ {
65
+ date: " 2015-03-19" ,
66
+ celebrationDate: " 2015-03-23" ,
67
+ name: {
68
+ es: " San José" ,
69
+ en: " Saint Joseph's Day" ,
70
+ },
71
+ nextMonday: true ,
72
+ },
73
+ {
74
+ date: " 2015-04-02" ,
75
+ celebrationDate: " 2015-04-02" ,
76
+ { es: " Jueves Santo" , en: " Maundy Thursday" },
77
+ nextMonday: false ,
78
+ },
79
+ {
80
+ date: " 2015-04-03" ,
81
+ celebrationDate: " 2015-04-03" ,
82
+ { es: " Viernes Santo" , en: " Good Friday" },
83
+ nextMonday: false ,
84
+ },
85
+ {
86
+ date: " 2015-05-01" ,
87
+ celebrationDate: " 2015-05-01" ,
88
+ name: {
89
+ es: " Día del Trabajo" ,
90
+ en: " Labour Day" ,
91
+ }
92
+ nextMonday: false ,
93
+ },
94
+ {
95
+ date: " 2015-05-14" ,
96
+ celebrationDate: " 2015-05-18" ,
97
+ name: { es: " Ascensión del Señor" , en: " Ascension of Jesus" },
98
+ nextMonday: true ,
99
+ },
100
+ {
101
+ date: " 2015-06-04" ,
102
+ celebrationDate: " 2015-06-08" ,
103
+ name: { es: " Corpus Christi" , en: " Corpus Christi" },
104
+ nextMonday: true ,
105
+ },
106
+ {
107
+ date: " 2015-06-12" ,
108
+ celebrationDate: " 2015-06-15" ,
109
+ name: { es: " Sagrado Corazón de Jesús" , en: " Sacred Heart" },
110
+ nextMonday: true ,
111
+ },
112
+ {
113
+ date: " 2015-06-29" ,
114
+ celebrationDate: " 2015-06-29" ,
115
+ name: {
116
+ es: " San Pedro y San Pablo" ,
117
+ en: " Saint Peter and Saint Paul" ,
118
+ },
119
+ nextMonday: true ,
120
+ },
121
+ {
122
+ date: " 2015-07-20" ,
123
+ celebrationDate: " 2015-07-20" ,
124
+ name: {
125
+ es: " Grito de la Independencia" ,
126
+ en: " Declaration of Independence" ,
127
+ },
128
+ nextMonday: false ,
129
+ },
130
+ {
131
+ date: " 2015-08-07" ,
132
+ celebrationDate: " 2015-08-07" ,
133
+ name: {
134
+ es: " Batalla de Boyacá" ,
135
+ en: " Battle of Boyacá" ,
136
+ },
137
+ nextMonday: false ,
138
+ },
139
+ {
140
+ date: " 2015-08-15" ,
141
+ celebrationDate: " 2015-08-17" ,
142
+ name: {
143
+ es: " Asunción de la Virgen" ,
144
+ en: " Assumption of Mary" ,
145
+ },
146
+ nextMonday: true ,
147
+ },
148
+ {
149
+ date: " 2015-10-12" ,
150
+ celebrationDate: " 2015-10-12" ,
151
+ name: {
152
+ es: " Día de la Raza" ,
153
+ en: " Columbus Day" ,
154
+ },
155
+ nextMonday: true ,
156
+ },
157
+ {
158
+ date: " 2015-11-01" ,
159
+ celebrationDate: " 2015-11-02" ,
160
+ name: {
161
+ es: " Todos los Santos" ,
162
+ en: " All Saints’ Day" ,
163
+ },
164
+ nextMonday: true ,
165
+ },
166
+ {
167
+ date: " 2015-11-11" ,
168
+ celebrationDate: " 2015-11-16" ,
169
+ name: { es: " Independencia de Cartagena" , en: " Independence of Cartagena" },
170
+ nextMonday: true ,
171
+ },
172
+ {
173
+ date: " 2015-12-08" ,
174
+ celebrationDate: " 2015-12-08" ,
175
+ name: { es: " Inmaculada Concepción" , en: " Immaculate Conception" },
176
+ nextMonday: false ,
177
+ },
178
+ {
179
+ date: " 2015-12-25" ,
180
+ celebrationDate: " 2015-12-25" ,
181
+ name: { es: " Navidad" , en: " Christmas" },
182
+ nextMonday: false ,
183
+ },
184
+ ];
66
185
```
67
- <!-- prettier-ignore-end -->
68
186
69
187
You can opt-in to have the function return native JavaScript dates instead of strings for the ` date ` and ` celebrationDate ` properties by using the ` returnNativeDate ` option:
70
188
71
- <!-- prettier-ignore-start -->
72
-
73
189
``` js
74
190
const colombianHolidays2015 = colombianHolidays (2015 , { returnNativeDate });
75
191
```
@@ -89,14 +205,14 @@ The package provides two helper functions which can be imported from `lib/utils`
89
205
Returns true if the given date is a colombian holiday, otherwise returns false.
90
206
91
207
``` js
92
- import { isHoliday } from ' colombian-holidays/lib/utils/isHoliday'
208
+ import { isHoliday } from " colombian-holidays/lib/utils/isHoliday" ;
93
209
94
- const date = new Date (" 2018-01-01T05:00:00.000Z" )
210
+ const date = new Date (" 2018-01-01T05:00:00.000Z" );
95
211
96
212
if (isHoliday (date)) {
97
- console .log (' it is a colombian holiday' );
213
+ console .log (" it is a colombian holiday" );
98
214
} else {
99
- console .log (' it is NOT a colombian holiday' );
215
+ console .log (" it is NOT a colombian holiday" );
100
216
}
101
217
```
102
218
@@ -105,7 +221,7 @@ if (isHoliday(date)) {
105
221
Returns an with the colombian holidays within two dates:
106
222
107
223
``` js
108
- import { holidaysWithinInterval } from ' colombian-holidays/lib/utils/holidaysWithinInterval'
224
+ import { holidaysWithinInterval } from " colombian-holidays/lib/utils/holidaysWithinInterval" ;
109
225
110
226
const start = new Date (" 2021-01-01" );
111
227
const end = new Date (" 2021-01-11" );
@@ -119,16 +235,22 @@ returns:
119
235
{
120
236
celebrationDate: " 2021-01-01" ,
121
237
date: " 2021-01-01" ,
122
- name: " Año Nuevo" ,
238
+ name: {
239
+ es: " Año Nuevo" ,
240
+ en: " New Year's day" ,
241
+ },
123
242
nextMonday: false ,
124
243
},
125
244
{
126
245
celebrationDate: " 2021-01-11" ,
127
246
date: " 2021-01-06" ,
128
- name: " Reyes Magos" ,
247
+ name: {
248
+ es: " Reyes Magos" ,
249
+ en: " Epiphany" ,
250
+ },
129
251
nextMonday: true ,
130
252
},
131
- ]
253
+ ];
132
254
```
133
255
134
256
### TypeScript
0 commit comments