@osimatic/helpers-js 1.1.43 → 1.1.44

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 +10 -5
  2. package/package.json +1 -1
package/date_time.js CHANGED
@@ -395,7 +395,7 @@ class SqlDate {
395
395
  if (sqlDate == null) {
396
396
  return null;
397
397
  }
398
- return new Date(sqlDate.substring(0, 4), sqlDate.substring(5, 7)-1, sqlDate.substring(8, 10), 0, 0, 0);
398
+ return new Date(Date.UTC(sqlDate.substring(0, 4), sqlDate.substring(5, 7)-1, sqlDate.substring(8, 10), 0, 0, 0));
399
399
  }
400
400
 
401
401
  static getCurrentSqlDate() {
@@ -441,10 +441,14 @@ class SqlTime {
441
441
  if ((sqlTime.match(/\:/g) || []).length == 1) {
442
442
  sqlTime += ':00';
443
443
  }
444
- let jsDate = new Date();
444
+
445
445
  let arrayTime = sqlTime.split(':');
446
- jsDate.setHours(arrayTime[0], arrayTime[1], arrayTime[2], 0);
447
- return jsDate;
446
+ return new Date(Date.UTC(1970, 0, 1, arrayTime[0], arrayTime[1], arrayTime[2]));
447
+
448
+ /*let jsDate = new Date();
449
+ jsDate.setUTCFullYear(1970, 0, 1);
450
+ jsDate.setUTCHours(arrayTime[0], arrayTime[1], arrayTime[2], 0);
451
+ return jsDate;*/
448
452
  }
449
453
 
450
454
  static getCurrentSqlTime() {
@@ -489,7 +493,8 @@ class SqlDateTime {
489
493
  if (sqlDateTime == null) {
490
494
  return null;
491
495
  }
492
- return new Date(sqlDateTime.substring(0, 4), sqlDateTime.substring(5, 7)-1, sqlDateTime.substring(8, 10), sqlDateTime.substring(11, 13), sqlDateTime.substring(14, 16), sqlDateTime.substring(17, 19));
496
+ //return new Date(sqlDateTime.substring(0, 4), sqlDateTime.substring(5, 7)-1, sqlDateTime.substring(8, 10), sqlDateTime.substring(11, 13), sqlDateTime.substring(14, 16), sqlDateTime.substring(17, 19));
497
+ return new Date(Date.UTC(sqlDateTime.substring(0, 4), sqlDateTime.substring(5, 7)-1, sqlDateTime.substring(8, 10), sqlDateTime.substring(11, 13), sqlDateTime.substring(14, 16), sqlDateTime.substring(17, 19)));
493
498
  }
494
499
 
495
500
  static getDateDigitalDisplay(sqlDateTime, locale="fr-FR", timeZone="Europe/Paris") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.43",
3
+ "version": "1.1.44",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"