@molopos/shared 2.0.10 → 2.0.12

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 CHANGED
@@ -36,4 +36,23 @@ export declare const formateMMLongDate: (date: Date, locale: string) => string;
36
36
  export declare const formateDDDate: (date: Date, lang: string) => string;
37
37
  export declare const formateddLLDate: (date: Date, lang: string) => string;
38
38
  export declare const formateDDDateISO: (date: Date, locale: string) => string;
39
+ /**
40
+ * Format a date to a string
41
+ * @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
42
+ * @param locale - The locale to use (e.g. "en-US", "it-IT", "fr-FR", etc.)
43
+ * @returns The formatted date (e.g. "1 Jan 2026", "1 Jan 2026 00:00", etc.)
44
+ *
45
+ * @example
46
+ * formateToUnixIntegerddLLLyyyy("2026-01-01", "en-US"); // "1 Jan 2026"
47
+ */
39
48
  export declare const formateToUnixIntegerddLLLyyyy: (date: Numberlike, locale: string) => string;
49
+ /**
50
+ * Format a date to a string
51
+ * @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
52
+ * @param lang - The locale to use (e.g. "en-US", "it-IT", "fr-FR", etc.)
53
+ * @returns The formatted date (e.g. "1 Jan 2026", "1 Jan 2026 00:00", etc.)
54
+ *
55
+ * @example
56
+ * formateTDate("2026-01-01", "en-US"); // "1 Jan 2026"
57
+ */
58
+ export declare const formateTDate: (date: Date, lang: string) => string;
package/date/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.formatDateToUtc = exports.formateHHmm = exports.formateYYDDMM = exports.formateddLLLyyyy = exports.formateDate = void 0;
3
+ 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.formatDateToUtc = exports.formateHHmm = exports.formateYYDDMM = exports.formateddLLLyyyy = exports.formateDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
5
  const luxon_1 = require("luxon");
6
6
  /**
@@ -107,8 +107,30 @@ const formateDDDateISO = (date, locale) => {
107
107
  return dateInit.setLocale(locale).toFormat("DD");
108
108
  };
109
109
  exports.formateDDDateISO = formateDDDateISO;
110
+ /**
111
+ * Format a date to a string
112
+ * @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
113
+ * @param locale - The locale to use (e.g. "en-US", "it-IT", "fr-FR", etc.)
114
+ * @returns The formatted date (e.g. "1 Jan 2026", "1 Jan 2026 00:00", etc.)
115
+ *
116
+ * @example
117
+ * formateToUnixIntegerddLLLyyyy("2026-01-01", "en-US"); // "1 Jan 2026"
118
+ */
110
119
  const formateToUnixIntegerddLLLyyyy = (date, locale) => {
111
120
  const dateInit = luxon_1.DateTime.fromSeconds(Number(date));
112
121
  return dateInit.setLocale(locale).toFormat("dd LLL yyyy");
113
122
  };
114
123
  exports.formateToUnixIntegerddLLLyyyy = formateToUnixIntegerddLLLyyyy;
124
+ /**
125
+ * Format a date to a string
126
+ * @param date - The date to format (e.g. "2026-01-01", "2026-01-01T00:00:00.000Z", etc.)
127
+ * @param lang - The locale to use (e.g. "en-US", "it-IT", "fr-FR", etc.)
128
+ * @returns The formatted date (e.g. "1 Jan 2026", "1 Jan 2026 00:00", etc.)
129
+ *
130
+ * @example
131
+ * formateTDate("2026-01-01", "en-US"); // "1 Jan 2026"
132
+ */
133
+ const formateTDate = (date, lang) => {
134
+ return luxon_1.DateTime.fromJSDate(date).setLocale(lang).toFormat("t");
135
+ };
136
+ exports.formateTDate = formateTDate;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.10","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"date-fns":"^4.1.0","luxon":"^3.7.2"}}
1
+ {"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.12","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"date-fns":"^4.1.0","luxon":"^3.7.2"}}