@molopos/shared 2.0.12 → 2.0.14
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.js +4 -11
- package/package.json +1 -1
package/date/index.js
CHANGED
|
@@ -14,22 +14,15 @@ const luxon_1 = require("luxon");
|
|
|
14
14
|
*/
|
|
15
15
|
const formateDate = (date, locale) => {
|
|
16
16
|
let dateReturn = null;
|
|
17
|
-
const todaysDate =
|
|
17
|
+
const todaysDate = (0, exports.dateTimeNowUtc)();
|
|
18
18
|
const currentYear = todaysDate.getFullYear();
|
|
19
19
|
const dateInit = luxon_1.DateTime.fromISO(String(date));
|
|
20
20
|
const dateYear = Number(dateInit.toFormat("yyyy"));
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (todayNowDateFormatted === todayDateFormatted) {
|
|
24
|
-
dateReturn = dateInit.setLocale(locale).toRelative();
|
|
21
|
+
if (currentYear === dateYear) {
|
|
22
|
+
dateReturn = dateInit.setLocale(locale).toFormat("dd MMM HH:mm");
|
|
25
23
|
}
|
|
26
24
|
else {
|
|
27
|
-
|
|
28
|
-
dateReturn = dateInit.setLocale(locale).toFormat("dd LLL HH:mm");
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
dateReturn = (0, exports.formatDateDDMMYYToUtc)(date, locale);
|
|
32
|
-
}
|
|
25
|
+
dateReturn = (0, exports.formatDateDDMMYYToUtc)(date, locale);
|
|
33
26
|
}
|
|
34
27
|
return dateReturn;
|
|
35
28
|
};
|
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.14","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"}}
|