ngx-wapp-components 3.2.12-alpha.2 → 3.2.12
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.
|
@@ -4416,6 +4416,16 @@ class WPeriodSelectFieldComponent {
|
|
|
4416
4416
|
ngOnInit() {
|
|
4417
4417
|
this.initPeriodCategorySelect();
|
|
4418
4418
|
}
|
|
4419
|
+
coerceToDate(value) {
|
|
4420
|
+
if (!value) {
|
|
4421
|
+
return null;
|
|
4422
|
+
}
|
|
4423
|
+
if (value instanceof Date) {
|
|
4424
|
+
return value;
|
|
4425
|
+
}
|
|
4426
|
+
const parsedDate = new Date(value);
|
|
4427
|
+
return isNaN(parsedDate.getTime()) ? null : parsedDate;
|
|
4428
|
+
}
|
|
4419
4429
|
initPeriodCategorySelect() {
|
|
4420
4430
|
const key24H = PeriodSelectEnum[PeriodSelectEnum.Last24Hours].toLowerCase();
|
|
4421
4431
|
const key3M = PeriodSelectEnum[PeriodSelectEnum.Last3Months].toLowerCase();
|
|
@@ -4433,10 +4443,9 @@ class WPeriodSelectFieldComponent {
|
|
|
4433
4443
|
}
|
|
4434
4444
|
initValues() {
|
|
4435
4445
|
if (this.periodSelectValue) {
|
|
4436
|
-
this.writeValue(this.
|
|
4437
|
-
this.
|
|
4438
|
-
this.
|
|
4439
|
-
this.toDateValue = new Date(this.periodSelectValue.toDate.toISOString().replace(/Z$/, ''));
|
|
4446
|
+
this.writeValue(this.periodSelectValue);
|
|
4447
|
+
this.fromDateValue = this.coerceToDate(this.periodSelectValue.fromDate);
|
|
4448
|
+
this.toDateValue = this.coerceToDate(this.periodSelectValue.toDate);
|
|
4440
4449
|
}
|
|
4441
4450
|
}
|
|
4442
4451
|
onFromDateChange() {
|
|
@@ -5738,11 +5747,11 @@ class WFilterPanelComponent {
|
|
|
5738
5747
|
});
|
|
5739
5748
|
}
|
|
5740
5749
|
else {
|
|
5741
|
-
if (query.field === 'periodSelect' && query.value.periodType === PeriodSelectEnum.Last24Hours) {
|
|
5750
|
+
if (query.field === 'periodSelect' && query.value && query.value.periodType === PeriodSelectEnum.Last24Hours) {
|
|
5742
5751
|
query.value.toDate = new Date();
|
|
5743
5752
|
query.value.fromDate = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
|
|
5744
5753
|
}
|
|
5745
|
-
if (query.field === 'periodSelect' && query.value.periodType === PeriodSelectEnum.Last3Months) {
|
|
5754
|
+
if (query.field === 'periodSelect' && query.value && query.value.periodType === PeriodSelectEnum.Last3Months) {
|
|
5746
5755
|
query.value.toDate = new Date();
|
|
5747
5756
|
query.value.fromDate = new Date(new Date().setMonth(new Date().getMonth() - 3));
|
|
5748
5757
|
}
|