@molopos/shared 2.0.86 → 2.0.87
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/date/index.d.ts +18 -1
- package/date/index.js +30 -3
- package/package.json +1 -1
package/date/index.d.ts
CHANGED
|
@@ -28,7 +28,24 @@ export declare const formateDate: (date: Date, locale: string) => string;
|
|
|
28
28
|
export declare const formateddLLLyyyy: (date: DateLike, locale: string) => string;
|
|
29
29
|
export declare const formateYYDDMM: (date: Date, locale: string) => string;
|
|
30
30
|
export declare const formateHHmm: (date: Date, locale: string) => string;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Format a date to a string
|
|
33
|
+
* @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
|
|
34
|
+
* @returns The formatted date (e.g. "01-01-2026", "01-01-2026 00:00:00", etc.)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* formatDateFnsToDdMMYYYY("2026-01-01"); // "01-01-2026"
|
|
38
|
+
*/
|
|
39
|
+
export declare const formatDateFnsToDdMMYYYY: (date: Date) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Format a date to a string
|
|
42
|
+
* @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
|
|
43
|
+
* @returns The formatted date (e.g. "01-01-2026 00:00:00", "01-01-2026 00:00:00", etc.)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* formatDateFnsToDdMMYYYYHHmmss("2026-01-01"); // "01-01-2026 00:00:00"
|
|
47
|
+
*/
|
|
48
|
+
export declare const formatDateFnsToDdMMYYYYHHmm: (date: Date) => string;
|
|
32
49
|
export declare const formatDateDDMMYYToUtc: (date: Date, locale: string) => string;
|
|
33
50
|
export declare const formateToT: (date: Date) => string;
|
|
34
51
|
export declare const dateTimeNowUtc: () => Date;
|
package/date/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recurrenceDate = exports.subtractDaysToDateTime = exports.subtractDaysToDateTimeNowUtc = exports.formateDateUnixInteger = exports.dateTimeNowUtcUnixInteger = exports.formateTDate = exports.formateToUnixIntegerddLLLyyyy = exports.formateDDDateISO = exports.formateddLLDate = exports.formateDDDate = exports.formateMMLongDate = exports.addDaysToTimeNowUtcDate = exports.viewYyformateToYyyy = exports.formateToyyyy = exports.formateToRFC2822 = exports.formateToLLLL = exports.formateTodd = exports.formateToCccc = exports.dateTimeNowUtc = exports.formateToT = exports.formatDateDDMMYYToUtc = exports.
|
|
3
|
+
exports.recurrenceDate = exports.subtractDaysToDateTime = exports.subtractDaysToDateTimeNowUtc = exports.formateDateUnixInteger = exports.dateTimeNowUtcUnixInteger = exports.formateTDate = exports.formateToUnixIntegerddLLLyyyy = exports.formateDDDateISO = exports.formateddLLDate = exports.formateDDDate = exports.formateMMLongDate = exports.addDaysToTimeNowUtcDate = exports.viewYyformateToYyyy = exports.formateToyyyy = exports.formateToRFC2822 = exports.formateToLLLL = exports.formateTodd = exports.formateToCccc = exports.dateTimeNowUtc = exports.formateToT = exports.formatDateDDMMYYToUtc = exports.formatDateFnsToDdMMYYYYHHmm = exports.formatDateFnsToDdMMYYYY = exports.formateHHmm = exports.formateYYDDMM = exports.formateddLLLyyyy = exports.formateDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
|
+
const locale_1 = require("date-fns/locale");
|
|
5
6
|
const luxon_1 = require("luxon");
|
|
6
7
|
const enum_1 = require("../enum");
|
|
8
|
+
const dataFnsLocale = {
|
|
9
|
+
es: locale_1.es,
|
|
10
|
+
ru: locale_1.ru,
|
|
11
|
+
it: locale_1.it,
|
|
12
|
+
fr: locale_1.fr,
|
|
13
|
+
en: locale_1.enUS,
|
|
14
|
+
de: locale_1.de,
|
|
15
|
+
};
|
|
7
16
|
/**
|
|
8
17
|
* Format a date to a string
|
|
9
18
|
* @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
|
|
@@ -52,8 +61,26 @@ const formateHHmm = (date, locale) => {
|
|
|
52
61
|
return dateInit.setLocale(locale).toFormat("t");
|
|
53
62
|
};
|
|
54
63
|
exports.formateHHmm = formateHHmm;
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Format a date to a string
|
|
66
|
+
* @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
|
|
67
|
+
* @returns The formatted date (e.g. "01-01-2026", "01-01-2026 00:00:00", etc.)
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* formatDateFnsToDdMMYYYY("2026-01-01"); // "01-01-2026"
|
|
71
|
+
*/
|
|
72
|
+
const formatDateFnsToDdMMYYYY = (date) => (0, date_fns_1.format)(date, "dd-MM-yyyy");
|
|
73
|
+
exports.formatDateFnsToDdMMYYYY = formatDateFnsToDdMMYYYY;
|
|
74
|
+
/**
|
|
75
|
+
* Format a date to a string
|
|
76
|
+
* @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
|
|
77
|
+
* @returns The formatted date (e.g. "01-01-2026 00:00:00", "01-01-2026 00:00:00", etc.)
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* formatDateFnsToDdMMYYYYHHmmss("2026-01-01"); // "01-01-2026 00:00:00"
|
|
81
|
+
*/
|
|
82
|
+
const formatDateFnsToDdMMYYYYHHmm = (date) => (0, date_fns_1.format)(date, "dd-MM-yyyy HH:mm");
|
|
83
|
+
exports.formatDateFnsToDdMMYYYYHHmm = formatDateFnsToDdMMYYYYHHmm;
|
|
57
84
|
const formatDateDDMMYYToUtc = (date, locale) => {
|
|
58
85
|
const dateInit = luxon_1.DateTime.fromISO(String(date));
|
|
59
86
|
return dateInit.setLocale(locale).toFormat("D");
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.
|
|
1
|
+
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.87","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"class-transformer":"^0.5.1","date-fns":"^4.4.0","luxon":"^3.7.2"}}
|