@osimatic/helpers-js 1.1.51 → 1.1.52

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_time.js +11 -10
  2. package/package.json +1 -1
package/date_time.js CHANGED
@@ -63,7 +63,7 @@ class DateTimeFormatter {
63
63
 
64
64
  return this.timeDigitalFormatter[timeZone+locale];
65
65
  }
66
- }
66
+ }
67
67
 
68
68
  class DateTime {
69
69
  static getSqlDate(jsDate, timeZone="Europe/Paris") {
@@ -147,15 +147,15 @@ class DateTime {
147
147
  static getDay(jsDate) {
148
148
  return jsDate.getUTCDate();
149
149
  }
150
-
150
+
151
151
  static getDayOfMonth(jsDate) {
152
152
  return jsDate.getUTCDate();
153
153
  }
154
-
154
+
155
155
  static getDayOfWeek(jsDate) {
156
156
  return jsDate.getUTCDay();
157
157
  }
158
-
158
+
159
159
  static getDayName(jsDate, locale="fr-FR", isShort=false) {
160
160
  return jsDate.toLocaleDateString(locale, {weekday: (isShort?'short':'long')});
161
161
  }
@@ -277,7 +277,7 @@ class DateTime {
277
277
  return jsDateTime > today;
278
278
  }
279
279
 
280
- static getNbDayBetweenTwo(jsDate1, jsDate2, asPeriod, timeZone="Europe/Paris") {
280
+ static getNbDayBetweenTwo(jsDate1, jsDate2, asPeriod=false, timeZone="Europe/Paris") {
281
281
  //jsDate1.set
282
282
  if (jsDate1 == null || jsDate2 == null) {
283
283
  return 0;
@@ -371,7 +371,7 @@ class TimestampUnix {
371
371
  return DateTime.isDateEqual(this.parse(timestamp1), this.parse(timestamp2));
372
372
  }
373
373
 
374
- static getNbDayBetweenTwo(timestamp1, timestamp2, asPeriod, timeZone="Europe/Paris") {
374
+ static getNbDayBetweenTwo(timestamp1, timestamp2, asPeriod=false, timeZone="Europe/Paris") {
375
375
  return DateTime.getNbDayBetweenTwo(this.parse(timestamp1), this.parse(timestamp2), asPeriod, timeZone);
376
376
  }
377
377
 
@@ -437,7 +437,9 @@ class SqlDate {
437
437
  static isDateInTheFuture(sqlDate) {
438
438
  return DateTime.isDateInTheFuture(SqlDateTime.parse(sqlDate + " 00:00:00"));
439
439
  }
440
-
440
+ static getNbDayBetweenTwo(sqlDate1, sqlDate2, asPeriod=false) {
441
+ return DateTime.getNbDayBetweenTwo(SqlDateTime.parse(sqlDate1 + " 00:00:00"), SqlDateTime.parse(sqlDate2 + " 00:00:00"), asPeriod);
442
+ }
441
443
  }
442
444
 
443
445
  /**
@@ -448,7 +450,7 @@ class SqlTime {
448
450
  if (sqlTime == null) {
449
451
  return null;
450
452
  }
451
-
453
+
452
454
  if ((sqlTime.match(/\:/g) || []).length == 1) {
453
455
  sqlTime += ':00';
454
456
  }
@@ -483,7 +485,6 @@ class SqlTime {
483
485
  static getTimestamp(sqlTime) {
484
486
  return SqlDateTime.getTimestamp('1970-01-01 '+sqlTime);
485
487
  }
486
-
487
488
  }
488
489
 
489
490
  /**
@@ -569,7 +570,7 @@ class SqlDateTime {
569
570
  return DateTime.isDateTimeInTheFuture(this.parse(sqlDateTime));
570
571
  }
571
572
 
572
- static getNbDayBetweenTwo(sqlDateTime1, sqlDateTime2, asPeriod) {
573
+ static getNbDayBetweenTwo(sqlDateTime1, sqlDateTime2, asPeriod=false) {
573
574
  return DateTime.getNbDayBetweenTwo(this.parse(sqlDateTime1), this.parse(sqlDateTime2), asPeriod);
574
575
  }
575
576
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.51",
3
+ "version": "1.1.52",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"