@molopos/shared 2.1.1 → 2.1.2
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 +6 -2
- package/package.json +1 -1
package/date/index.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.dateTimeNowUtc = dateTimeNowUtc;
|
|
|
21
21
|
*/
|
|
22
22
|
const formateDate = (date, locale) => {
|
|
23
23
|
const localeFormat = locale !== "en" ? "dd MMM p" : "MMM dd, p";
|
|
24
|
-
const isYearControle = (0, date_fns_1.getYear)((0,
|
|
24
|
+
const isYearControle = (0, date_fns_1.getYear)(date) >= (0, date_fns_1.getYear)((0, exports.dateTimeNowUtc)());
|
|
25
25
|
return (0, date_fns_1.format)(date, isYearControle ? localeFormat : "P", {
|
|
26
26
|
locale: dataFnsLocale[locale],
|
|
27
27
|
});
|
|
@@ -119,7 +119,11 @@ const recurrenceDate = ({ date, recurrence, duration = 1, isRecurrence = false,
|
|
|
119
119
|
if (isFutureDate) {
|
|
120
120
|
return (0, date_fns_1.addYears)(dateNowInit, duration);
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
const now = (0, exports.dateTimeNowUtc)();
|
|
123
|
+
let nextOccurrence = (0, date_fns_1.set)(now, {
|
|
124
|
+
month: dateInit.getMonth(),
|
|
125
|
+
date: dateInit.getDate(),
|
|
126
|
+
});
|
|
123
127
|
if ((0, exports.formateDateUnixInteger)(nextOccurrence) <= dateNowUnix) {
|
|
124
128
|
nextOccurrence = (0, date_fns_1.addYears)(nextOccurrence, duration);
|
|
125
129
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.1.
|
|
1
|
+
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.1.2","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"}}
|