@osimatic/helpers-js 1.1.69 → 1.1.71

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.
@@ -180,7 +180,7 @@ class TelephoneNumber {
180
180
  }
181
181
 
182
182
  static getEnteredNumberInInternationalFormat(intlTelInput) {
183
- return intlTelInput.getNumber(intlTelInputUtils.numberFormat.E164);
183
+ return intlTelInput.getNumber(window.intlTelInput.utils.numberFormat.E164);
184
184
  }
185
185
 
186
186
  static formatNumberFromIntlTelInput(intlTelInput) {
package/date_time.js CHANGED
@@ -96,7 +96,7 @@ class DateTime {
96
96
  }
97
97
 
98
98
  static getTimestamp(jsDate) {
99
- return jsDate.getTime()/1000;
99
+ return Math.trunc(jsDate.getTime()/1000);
100
100
  }
101
101
 
102
102
  static getDateDigitalDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
@@ -298,6 +298,20 @@ class DateTime {
298
298
  }
299
299
  return parseInt(Math.round((timestamp2-timestamp1)/86400));
300
300
  }
301
+
302
+ static addDays(date, days) {
303
+ date.setUTCDate(date.getUTCDate() + days);
304
+ return date;
305
+ }
306
+
307
+ static addMonths(date, months) {
308
+ let d = date.getDate();
309
+ date.setMonth(date.getMonth() + +months);
310
+ if (date.getDate() !== d) {
311
+ date.setDate(0);
312
+ }
313
+ return date;
314
+ }
301
315
  }
302
316
 
303
317
  class TimestampUnix {
@@ -576,5 +590,4 @@ class SqlDateTime {
576
590
 
577
591
  }
578
592
 
579
-
580
593
  module.exports = { DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.69",
3
+ "version": "1.1.71",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"