@molopos/shared 2.0.57 → 2.0.58
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 +12 -5
- package/package.json +1 -1
package/date/index.js
CHANGED
|
@@ -167,11 +167,18 @@ const recurrenceDate = ({ date, recurrence, duration = 1, isRecurrence = false,
|
|
|
167
167
|
if (!isRecurrence) {
|
|
168
168
|
return null;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
const dateNowUnix = (0, exports.dateTimeNowUtcUnixInteger)();
|
|
171
|
+
const dateUnix = (0, exports.formateDateUnixInteger)(date);
|
|
172
|
+
const isFutureDate = dateUnix > dateNowUnix;
|
|
173
|
+
const preservesDay = recurrence === enum_1.RecurrenceEnum.Monthly ||
|
|
174
|
+
recurrence === enum_1.RecurrenceEnum.Yearly;
|
|
175
|
+
const dateNowInit = preservesDay
|
|
176
|
+
? isFutureDate
|
|
177
|
+
? luxon_1.DateTime.fromJSDate(date)
|
|
178
|
+
: luxon_1.DateTime.fromJSDate((0, exports.dateTimeNowUtc)()).set({ day: date.getDate() })
|
|
179
|
+
: isFutureDate
|
|
180
|
+
? luxon_1.DateTime.fromJSDate(date)
|
|
181
|
+
: luxon_1.DateTime.fromJSDate((0, exports.dateTimeNowUtc)());
|
|
175
182
|
switch (recurrence) {
|
|
176
183
|
case enum_1.RecurrenceEnum.Daily:
|
|
177
184
|
return dateNowInit.plus({ days: duration }).toJSDate();
|
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.58","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"}}
|