@osimatic/helpers-js 1.2.6 → 1.2.8

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 CHANGED
@@ -121,7 +121,7 @@ class DateTime {
121
121
 
122
122
  static getTimeDisplayWithNbDays(jsDate, jsPreviousDate, locale="fr-FR", timeZone="Europe/Paris") {
123
123
  let str = this.getTimeDisplay(jsDate, locale, timeZone);
124
- if (jsPreviousDate != 0 && jsPreviousDate != null) {
124
+ if (jsPreviousDate !== 0 && jsPreviousDate != null) {
125
125
  let nbDaysDiff = this.getNbDayBetweenTwo(jsPreviousDate, jsDate, false);
126
126
  if (nbDaysDiff > 0) {
127
127
  str += ' (J+'+nbDaysDiff+')';
@@ -238,7 +238,7 @@ class DateTime {
238
238
  }
239
239
 
240
240
  static isDateEqual(jsDate1, jsDate2) {
241
- return (jsDate1.getFullYear() == jsDate2.getFullYear() && jsDate1.getMonth() == jsDate2.getMonth() && jsDate1.getDate() == jsDate2.getDate());
241
+ return (jsDate1.getFullYear() === jsDate2.getFullYear() && jsDate1.getMonth() === jsDate2.getMonth() && jsDate1.getDate() === jsDate2.getDate());
242
242
  }
243
243
 
244
244
  static isDateInThePast(jsDate) {
@@ -465,7 +465,7 @@ class SqlTime {
465
465
  return null;
466
466
  }
467
467
 
468
- if ((sqlTime.match(/\:/g) || []).length == 1) {
468
+ if ((sqlTime.match(/\:/g) || []).length === 1) {
469
469
  sqlTime += ':00';
470
470
  }
471
471
 
package/duration.js CHANGED
@@ -51,18 +51,20 @@ class Duration {
51
51
  return (durationInSecondsOriginal < 0 ? '- ' : '')+hours+':'+minutes+(displayMode==='input_time'?':':'.')+seconds;
52
52
  }
53
53
 
54
- static convertToDurationInHourStringDisplay(durationInSeconds, withSecondes=true, withMinutes=true, withLibelleMinute=true, libelleEntier=false) {
54
+ static convertToDurationInHourStringDisplay(durationInSeconds, withSeconds=true, withMinutes=true, withMinuteLabel=true, fullLabel=false, hideHourIfZeroHour=false) {
55
55
  durationInSeconds = Math.round(durationInSeconds);
56
56
 
57
57
  // Heures
58
58
  let strHeure = '';
59
59
  let nbHeures = this.getNbHoursOfDurationInSeconds(durationInSeconds);
60
- strHeure += nbHeures;
61
- if (libelleEntier) {
62
- strHeure += ' heure'+(nbHeures>1?'s':'');
63
- }
64
- else {
65
- strHeure += 'h';
60
+ if (!hideHourIfZeroHour || nbHeures > 0) {
61
+ strHeure += nbHeures;
62
+ if (fullLabel) {
63
+ strHeure += ' heure'+(nbHeures>1?'s':'');
64
+ }
65
+ else {
66
+ strHeure += 'h';
67
+ }
66
68
  }
67
69
 
68
70
  // Minutes
@@ -73,8 +75,8 @@ class Duration {
73
75
  strMinute += ' ';
74
76
  //strMinute += sprintf('%02d', nbMinutes);
75
77
  strMinute += nbMinutes.toString().padStart(2, '0');
76
- if (withLibelleMinute) {
77
- if (libelleEntier) {
78
+ if (withMinuteLabel) {
79
+ if (fullLabel) {
78
80
  strMinute += ' minute'+(nbMinutes>1?'s':'');
79
81
  }
80
82
  else {
@@ -85,12 +87,12 @@ class Duration {
85
87
 
86
88
  // Secondes
87
89
  let strSeconde = '';
88
- if (withSecondes) {
90
+ if (withSeconds) {
89
91
  let nbSecondes = this.getNbSecondsRemainingOfDurationInSeconds(durationInSeconds);
90
92
  strSeconde += ' ';
91
93
  //strSeconde += sprintf('%02d', nbSecondes);
92
94
  strSeconde += nbSecondes.toString().padStart(2, '0');
93
- if (libelleEntier) {
95
+ if (fullLabel) {
94
96
  strSeconde += ' seconde'+(nbSecondes>1?'s':'');
95
97
  }
96
98
  else {
package/form_helper.js CHANGED
@@ -597,7 +597,7 @@ class ArrayField {
597
597
  return false;
598
598
  });
599
599
  divAdd.find('a.add').off('click').click(function () {
600
- submitAddNewItem(divAdd.find('input[type="text"]').val(), divAdd);
600
+ submitAddNewItem(divAdd.find('input.form-control[type="text"]').val(), divAdd);
601
601
  return false;
602
602
  });
603
603
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"