@osimatic/helpers-js 1.0.72 → 1.0.73

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 +6 -8
  2. package/package.json +1 -1
package/date_time.js CHANGED
@@ -26,7 +26,7 @@ class DateTimeFormatter {
26
26
 
27
27
  static getDateSqlFormatter(timeZone) {
28
28
  if (this.dateSqlFormatter == null) {
29
- this.dateSqlFormatter = new Intl.DateTimeFormat('fr-FR', { year: 'numeric', month: '2-digit', day: '2-digit', timeZone: timeZone });
29
+ this.dateSqlFormatter = new Intl.DateTimeFormat('fr-CA', { year: 'numeric', month: '2-digit', day: '2-digit', timeZone: timeZone });
30
30
  }
31
31
 
32
32
  return this.dateSqlFormatter;
@@ -60,8 +60,6 @@ class DateTimeFormatter {
60
60
  class DateTime {
61
61
  static getSqlDate(jsDate, timeZone="Europe/Paris") {
62
62
  return DateTimeFormatter.getDateSqlFormatter(timeZone).format(jsDate).replace(/\//g,'-').replace(',','');
63
-
64
- //24/08/22 bad perfs
65
63
  /*let pad = function(num) { return ('00'+num).slice(-2) };
66
64
  // return jsDate.getUTCFullYear() + '-' + pad(jsDate.getUTCMonth() + 1) + '-' + pad(jsDate.getUTCDate());
67
65
  //return jsDate.getFullYear() + '-' + pad(jsDate.getMonth() + 1) + '-' + pad(jsDate.getDate());
@@ -88,22 +86,22 @@ class DateTime {
88
86
 
89
87
  static getDateDigitalDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
90
88
  return DateTimeFormatter.getDateDigitalFormatter(locale, timeZone).format(jsDate);
91
- //return jsDate.toLocaleDateString(locale, {year: 'numeric', month: 'numeric', day: 'numeric', timeZone: timeZone}); //24/08/22 bad perfs
89
+ //return jsDate.toLocaleDateString(locale, {year: 'numeric', month: 'numeric', day: 'numeric', timeZone: timeZone});
92
90
  }
93
91
 
94
92
  static getDateTextDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
95
93
  return DateTimeFormatter.getDateTextFormatter(locale, timeZone).format(jsDate);
96
- //return jsDate.toLocaleDateString(locale, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: timeZone}); //24/08/22 bad perfs
94
+ //return jsDate.toLocaleDateString(locale, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: timeZone});
97
95
  }
98
96
 
99
97
  static getTimeDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
100
98
  return DateTimeFormatter.getTimeFormatter(locale, timeZone).format(jsDate);
101
- //return jsDate.toLocaleTimeString(locale, {hour: 'numeric', minute: 'numeric', timeZone: timeZone}); //24/08/22 bad perfs
99
+ //return jsDate.toLocaleTimeString(locale, {hour: 'numeric', minute: 'numeric', timeZone: timeZone});
102
100
  }
103
101
 
104
102
  static getTimeDigitalDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
105
103
  return DateTimeFormatter.getTimeDigitalFormatter(locale, timeZone).format(jsDate);
106
- //return jsDate.toLocaleTimeString(locale, {hour: '2-digit', minute: '2-digit', second: '2-digit', timeZone: timeZone}); //24/08/22 bad perfs
104
+ //return jsDate.toLocaleTimeString(locale, {hour: '2-digit', minute: '2-digit', second: '2-digit', timeZone: timeZone});
107
105
  }
108
106
 
109
107
  static getTimeDisplayWithNbDays(jsDate, jsPreviousDate, locale="fr-FR", timeZone="Europe/Paris") {
@@ -119,7 +117,7 @@ class DateTime {
119
117
 
120
118
  static getDateTimeDigitalDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
121
119
  return DateTimeFormatter.getDateTimeFormatter(locale, timeZone).format(jsDate);
122
- //return jsDate.toLocaleDateString(locale, {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZone: timeZone}); //24/08/22 bad perfs
120
+ //return jsDate.toLocaleDateString(locale, {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZone: timeZone});
123
121
  }
124
122
 
125
123
  static getYear(jsDate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"