ngx-hana-nameserver-history-viewer 1.1.9-5.beta → 1.1.9-8.beta
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/esm2020/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.component.mjs +2 -4
- package/esm2020/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.service.mjs +2 -4
- package/esm2020/src/nameserver-history-viewer/utils/time-util.mjs +11 -2
- package/fesm2015/ngx-hana-nameserver-history-viewer.mjs +15 -10
- package/fesm2015/ngx-hana-nameserver-history-viewer.mjs.map +1 -1
- package/fesm2020/ngx-hana-nameserver-history-viewer.mjs +15 -10
- package/fesm2020/ngx-hana-nameserver-history-viewer.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import * as i2$1 from '@angular/forms';
|
|
|
6
6
|
import { FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1$1 from '@danielmoncada/angular-datetime-picker';
|
|
8
8
|
import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
|
|
9
|
-
import * as moment$
|
|
9
|
+
import * as moment$2 from 'moment-timezone';
|
|
10
10
|
import * as i2 from 'ngx-dropdown-list';
|
|
11
11
|
import { DropdownListModule } from 'ngx-dropdown-list';
|
|
12
12
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
@@ -548,7 +548,7 @@ function _getTimeRange(time) {
|
|
|
548
548
|
* get default local time zone
|
|
549
549
|
*/
|
|
550
550
|
function getDefaultTimezone() {
|
|
551
|
-
return moment$
|
|
551
|
+
return moment$2.tz.guess();
|
|
552
552
|
}
|
|
553
553
|
/**
|
|
554
554
|
* Get time from provided timezone, using this only because chart.js doesn't support timezone.
|
|
@@ -561,8 +561,8 @@ function getTimeFromTimeZone(time, timezone) {
|
|
|
561
561
|
timezone = getDefaultTimezone();
|
|
562
562
|
console.warn(`getTimeFromTimeZone - Input timezone is null, returning the local (${timezone}) time. `);
|
|
563
563
|
}
|
|
564
|
-
const utcOffset = moment$
|
|
565
|
-
const currentOffset = moment$
|
|
564
|
+
const utcOffset = moment$2.tz.zone(timezone).utcOffset(time * 1000);
|
|
565
|
+
const currentOffset = moment$2.tz.zone(getDefaultTimezone()).utcOffset(time * 1000);
|
|
566
566
|
// convert to utc and then to selected timezone
|
|
567
567
|
return time + currentOffset * 60 - utcOffset * 60;
|
|
568
568
|
}
|
|
@@ -570,7 +570,16 @@ function getTimeFromTimeZone(time, timezone) {
|
|
|
570
570
|
* Get time formatted with the provided timezone
|
|
571
571
|
*/
|
|
572
572
|
function getTimeString(time) {
|
|
573
|
-
|
|
573
|
+
console.log('3333312', time, '4444434', moment$2(time));
|
|
574
|
+
const dateTime = new Date(time);
|
|
575
|
+
const year = dateTime.getFullYear();
|
|
576
|
+
const month = ('0' + (dateTime.getMonth() + 1)).slice(-2);
|
|
577
|
+
const date = ('0' + dateTime.getDate()).slice(-2);
|
|
578
|
+
const hour = ('0' + dateTime.getHours()).slice(-2);
|
|
579
|
+
const minute = ('0' + dateTime.getMinutes()).slice(-2);
|
|
580
|
+
const second = ('0' + dateTime.getSeconds()).slice(-2);
|
|
581
|
+
return `${year}-${month}-${date} ${hour}:${minute}:${second}}`;
|
|
582
|
+
// return moment(time).format('YYYY-MM-DD HH:mm:ss');
|
|
574
583
|
}
|
|
575
584
|
/**
|
|
576
585
|
* Get the time range string by time array, eg: 2018-10-25 10:10:00 ~ 2018-10-25 12:12:00
|
|
@@ -760,8 +769,6 @@ function blobToFile(theBlob, fileName) {
|
|
|
760
769
|
return theBlob;
|
|
761
770
|
}
|
|
762
771
|
|
|
763
|
-
// workaround for fixing following error when doing packagr: Cannot call a namespace ('moment')
|
|
764
|
-
const moment$3 = moment$4;
|
|
765
772
|
class TimezoneSelectorService {
|
|
766
773
|
/**
|
|
767
774
|
* get the default timezone
|
|
@@ -774,7 +781,7 @@ class TimezoneSelectorService {
|
|
|
774
781
|
*/
|
|
775
782
|
getZones() {
|
|
776
783
|
const timezones = [];
|
|
777
|
-
const zones = moment$
|
|
784
|
+
const zones = moment$2.tz.names();
|
|
778
785
|
zones.forEach(zone => {
|
|
779
786
|
// get region
|
|
780
787
|
let region;
|
|
@@ -805,8 +812,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
805
812
|
type: Injectable
|
|
806
813
|
}] });
|
|
807
814
|
|
|
808
|
-
// workaround for fixing following error when doing packagr: Cannot call a namespace ('moment')
|
|
809
|
-
const moment$2 = moment$4;
|
|
810
815
|
class TimezoneSelectorComponent {
|
|
811
816
|
constructor(service) {
|
|
812
817
|
this.service = service;
|