@carlosdiazz/lottodiz-shared 1.2.3 → 1.2.4
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validateDate = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
8
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
9
|
+
require("dayjs/locale/es.js");
|
|
10
|
+
require("dayjs/locale/en.js");
|
|
9
11
|
dayjs_1.default.extend(utc_1.default);
|
|
10
12
|
const validateDate = (date_verify, arrs) => {
|
|
11
13
|
if (arrs.length === 0)
|
|
@@ -14,10 +16,21 @@ const validateDate = (date_verify, arrs) => {
|
|
|
14
16
|
if (!igual_dates)
|
|
15
17
|
throw new Error("arrs is different");
|
|
16
18
|
const date = arrs[0];
|
|
17
|
-
//
|
|
19
|
+
// Formatos en los dos idiomas
|
|
18
20
|
const format_dates = [
|
|
19
|
-
|
|
21
|
+
//Loterias Dominicanas
|
|
22
|
+
dayjs_1.default.utc(date_verify).format("DD-MM").toUpperCase(),
|
|
20
23
|
];
|
|
24
|
+
// Español
|
|
25
|
+
dayjs_1.default.locale("es");
|
|
26
|
+
format_dates.push(
|
|
27
|
+
//En Lote
|
|
28
|
+
dayjs_1.default.utc(date_verify).format("dddd D [de] MMMM, YYYY").toUpperCase());
|
|
29
|
+
// Ingles
|
|
30
|
+
dayjs_1.default.locale("en");
|
|
31
|
+
format_dates.push(
|
|
32
|
+
//Prueba Fecha Ingles
|
|
33
|
+
dayjs_1.default.utc(date_verify).format("dddd, MMMM D, YYYY").toUpperCase());
|
|
21
34
|
const is_valid = format_dates.includes(date);
|
|
22
35
|
if (!is_valid)
|
|
23
36
|
throw new Error("This is not the date to look for");
|