@osimatic/helpers-js 1.4.21 → 1.4.22
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_time.js +15 -0
- package/package.json +1 -1
package/date_time.js
CHANGED
|
@@ -298,6 +298,16 @@ class DateTime {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
class DatePeriod {
|
|
301
|
+
static isSameDay(jsDate1, jsDate2) {
|
|
302
|
+
return jsDate1.getFullYear() === jsDate2.getFullYear() &&
|
|
303
|
+
jsDate1.getMonth() === jsDate2.getMonth() &&
|
|
304
|
+
jsDate1.getDate() === jsDate2.getDate();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
static isHalfDay(partOfDay) {
|
|
308
|
+
return partOfDay === DatePeriod.PART_OF_DAY_MORNING || partOfDay === DatePeriod.PART_OF_DAY_AFTERNOON;
|
|
309
|
+
}
|
|
310
|
+
|
|
301
311
|
static getNbDayBetweenTwo(jsDate1, jsDate2, asPeriod=false, timeZone="Europe/Paris") {
|
|
302
312
|
//jsDate1.set
|
|
303
313
|
if (jsDate1 == null || jsDate2 == null) {
|
|
@@ -627,4 +637,9 @@ class SqlDateTime {
|
|
|
627
637
|
|
|
628
638
|
}
|
|
629
639
|
|
|
640
|
+
// Part of day
|
|
641
|
+
DatePeriod.PART_OF_DAY_MORNING = 'MORNING';
|
|
642
|
+
DatePeriod.PART_OF_DAY_AFTERNOON = 'AFTERNOON';
|
|
643
|
+
|
|
644
|
+
|
|
630
645
|
module.exports = { DateTime, DatePeriod, TimestampUnix, SqlDate, SqlTime, SqlDateTime };
|