colombian-holidays 1.8.1 → 2.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/README.md +158 -33
- package/package.json +1 -1
package/README.md
CHANGED
@@ -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
|
-
{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
{
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
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(
|
213
|
+
console.log("it is a colombian holiday");
|
98
214
|
} else {
|
99
|
-
console.log(
|
215
|
+
console.log("it is NOT a colombian holiday");
|
100
216
|
}
|
101
217
|
```
|
102
218
|
|
@@ -105,27 +221,36 @@ if (isHoliday(date)) {
|
|
105
221
|
Returns an with the colombian holidays within two dates:
|
106
222
|
|
107
223
|
```js
|
108
|
-
import { holidaysWithinInterval } from
|
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");
|
112
228
|
const holidays = holidaysWithinInterval({ start, end });
|
113
|
-
|
229
|
+
```
|
230
|
+
|
231
|
+
returns:
|
232
|
+
|
233
|
+
```js
|
114
234
|
[
|
115
235
|
{
|
116
236
|
celebrationDate: "2021-01-01",
|
117
237
|
date: "2021-01-01",
|
118
|
-
name:
|
238
|
+
name: {
|
239
|
+
es: "Año Nuevo",
|
240
|
+
en: "New Year's day",
|
241
|
+
},
|
119
242
|
nextMonday: false,
|
120
243
|
},
|
121
244
|
{
|
122
245
|
celebrationDate: "2021-01-11",
|
123
246
|
date: "2021-01-06",
|
124
|
-
name:
|
247
|
+
name: {
|
248
|
+
es: "Reyes Magos",
|
249
|
+
en: "Epiphany",
|
250
|
+
},
|
125
251
|
nextMonday: true,
|
126
252
|
},
|
127
|
-
]
|
128
|
-
*/
|
253
|
+
];
|
129
254
|
```
|
130
255
|
|
131
256
|
### TypeScript
|