@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.
Files changed (2) hide show
  1. package/date/index.js +4 -11
  2. 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 = new Date();
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
- const todayNowDateFormatted = (0, exports.formatDateToUtc)(date);
22
- const todayDateFormatted = (0, exports.formatDateToUtc)(todaysDate);
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
- if (currentYear === dateYear) {
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.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"}}
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"}}