wsp-ms-core 1.1.5 → 1.1.7
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/dist/index.cjs +44 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,48 @@ var _DateTime = class _DateTime extends ValueObject {
|
|
|
155
155
|
minusSeconds(seconds) {
|
|
156
156
|
return _DateTime.fromLuxon(this._dt.minus({ seconds }));
|
|
157
157
|
}
|
|
158
|
+
diffInDays(other) {
|
|
159
|
+
const left = this._dt.startOf("day");
|
|
160
|
+
const right = other._dt.startOf("day");
|
|
161
|
+
return Math.floor(
|
|
162
|
+
right.diff(left, "days").days
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
diffInDaysAbs(other) {
|
|
166
|
+
return Math.abs(this.diffInDays(other));
|
|
167
|
+
}
|
|
168
|
+
compareValue(other, unit) {
|
|
169
|
+
const left = unit === "day" ? this._dt.startOf("day") : this._dt;
|
|
170
|
+
const right = unit === "day" ? other._dt.startOf("day") : other._dt;
|
|
171
|
+
const a = left.toMillis();
|
|
172
|
+
const b = right.toMillis();
|
|
173
|
+
if (a === b) {
|
|
174
|
+
return 0;
|
|
175
|
+
}
|
|
176
|
+
return a < b ? -1 : 1;
|
|
177
|
+
}
|
|
178
|
+
compareTo(other, unit = _DateTime.COMPARE_UNIT_MILLIS) {
|
|
179
|
+
return this.compareValue(other, unit);
|
|
180
|
+
}
|
|
181
|
+
isBefore(other, unit = _DateTime.COMPARE_UNIT_MILLIS) {
|
|
182
|
+
return this.compareValue(other, unit) === -1;
|
|
183
|
+
}
|
|
184
|
+
isAfter(other, unit = _DateTime.COMPARE_UNIT_MILLIS) {
|
|
185
|
+
return this.compareValue(other, unit) === 1;
|
|
186
|
+
}
|
|
187
|
+
isSame(other, unit = _DateTime.COMPARE_UNIT_MILLIS) {
|
|
188
|
+
return this.compareValue(other, unit) === 0;
|
|
189
|
+
}
|
|
190
|
+
/** Comparación por fecha calendario (ignora hora) */
|
|
191
|
+
isSameDay(other) {
|
|
192
|
+
return this.isSame(other, _DateTime.COMPARE_UNIT_DAY);
|
|
193
|
+
}
|
|
194
|
+
isBeforeDay(other) {
|
|
195
|
+
return this.isBefore(other, _DateTime.COMPARE_UNIT_DAY);
|
|
196
|
+
}
|
|
197
|
+
isAfterDay(other) {
|
|
198
|
+
return this.isAfter(other, _DateTime.COMPARE_UNIT_DAY);
|
|
199
|
+
}
|
|
158
200
|
get year() {
|
|
159
201
|
return this._dt.year;
|
|
160
202
|
}
|
|
@@ -219,6 +261,8 @@ _DateTime.FORMAT_Y_M = "Y-M";
|
|
|
219
261
|
_DateTime.FORMAT_Y_M_D = "Y-M-D";
|
|
220
262
|
_DateTime.FORMAT_Y_M_D_H_m_s = "Y-M-D H:M:S";
|
|
221
263
|
_DateTime.FORMAT_D_M_Y = "D-M-Y";
|
|
264
|
+
_DateTime.COMPARE_UNIT_MILLIS = "millis";
|
|
265
|
+
_DateTime.COMPARE_UNIT_DAY = "day";
|
|
222
266
|
_DateTime.FORMATS = {
|
|
223
267
|
"Y-M": "yyyy-MM",
|
|
224
268
|
"Y-M-D": "yyyy-MM-dd",
|