@osimatic/helpers-js 1.1.70 → 1.1.72
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 -2
- package/duration.js +4 -0
- package/package.json +1 -1
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/duration.js
CHANGED
|
@@ -34,6 +34,8 @@ class Duration {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
static convertToDurationInHourChronoDisplay(durationInSeconds, displayMode='chrono') {
|
|
37
|
+
durationInSeconds = Math.round(durationInSeconds);
|
|
38
|
+
|
|
37
39
|
let durationInSecondsOriginal = durationInSeconds;
|
|
38
40
|
durationInSeconds = Math.abs(durationInSeconds);
|
|
39
41
|
let seconds = ( durationInSeconds % 60 );
|
|
@@ -50,6 +52,8 @@ class Duration {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
static convertToDurationInHourStringDisplay(durationInSeconds, withSecondes=true, withMinutes=true, withLibelleMinute=true, libelleEntier=false) {
|
|
55
|
+
durationInSeconds = Math.round(durationInSeconds);
|
|
56
|
+
|
|
53
57
|
// Heures
|
|
54
58
|
let strHeure = '';
|
|
55
59
|
let nbHeures = this.getNbHoursOfDurationInSeconds(durationInSeconds);
|