From 447ff49d06dfc0dd30c914de80db46ca681e9c54 Mon Sep 17 00:00:00 2001 From: simvalery Date: Tue, 10 Dec 2024 16:32:02 +0400 Subject: [PATCH] fix from Signed-off-by: simvalery --- .../controls/date-time/date-time.component.ts | 18 +++++++++++------- .../schema-form/schema-form.component.html | 2 +- .../sentinel-hub-type.component.ts | 5 +---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/modules/schema-engine/schema-form/controls/date-time/date-time.component.ts b/frontend/src/app/modules/schema-engine/schema-form/controls/date-time/date-time.component.ts index 8577070eb..1fee9deb2 100644 --- a/frontend/src/app/modules/schema-engine/schema-form/controls/date-time/date-time.component.ts +++ b/frontend/src/app/modules/schema-engine/schema-form/controls/date-time/date-time.component.ts @@ -36,7 +36,7 @@ export class DateTimeComponent implements OnInit, AfterViewInit, OnChanges, OnDe ngOnInit() { if (this.item.subject) { this.item.subject.subscribe(() => { - this.fillField(); + // this.fillField(); }) } } @@ -59,26 +59,30 @@ export class DateTimeComponent implements OnInit, AfterViewInit, OnChanges, OnDe const comment = this.item?.field?.comment && JSON.parse(this.item.field.comment); let value: any = null; if (this.timeOnly && this.type && comment && comment[this.type]) { - value = comment.suggest; + value = comment[this.type]; } else if (this.calendar?.value) { value = this.calendar?.value; } else if (this.item.value) { value = this.item.value; } - - const input = this.calendar?.el.nativeElement.querySelector('input') + console.log('fill', value, this.item); setTimeout(() => { + const input = this.calendar?.el.nativeElement.querySelector('input'); if (input && value) { if (this.timeOnly) { - const date = moment(value, 'hh-mm-ss').toDate(); + if (/^(\d+)-(\d+)-(\d+)$/.test(value)) { + + } + console.log(value instanceof Date, value, moment(value, 'hh:mm:ss').format('HH:mm:ss'), input); + const date = moment(value, 'hh:mm:ss').toDate(); this.control.setValue(date); - input.value = moment(value, 'hh-mm-ss').format('HH:mm:ss'); + input.value = moment(value, 'hh:mm:ss').format('HH:mm:ss'); } else { this.control.setValue(moment(value).toDate()) input.value = moment(value).format('YYYY-MM-DD HH:mm:ss'); } } - }) + }, 100) } } diff --git a/frontend/src/app/modules/schema-engine/schema-form/schema-form.component.html b/frontend/src/app/modules/schema-engine/schema-form/schema-form.component.html index c7e84365c..bc6f284e7 100644 --- a/frontend/src/app/modules/schema-engine/schema-form/schema-form.component.html +++ b/frontend/src/app/modules/schema-engine/schema-form/schema-form.component.html @@ -205,7 +205,7 @@
diff --git a/frontend/src/app/modules/schema-engine/sentinel-hub-type/sentinel-hub-type.component.ts b/frontend/src/app/modules/schema-engine/sentinel-hub-type/sentinel-hub-type.component.ts index 6c0a186ec..d75e18d6e 100644 --- a/frontend/src/app/modules/schema-engine/sentinel-hub-type/sentinel-hub-type.component.ts +++ b/frontend/src/app/modules/schema-engine/sentinel-hub-type/sentinel-hub-type.component.ts @@ -93,9 +93,6 @@ export class SentinelHubTypeComponent implements OnInit, OnChanges, AfterViewIni this.subscription.add( this.mapService.getSentinelKey().subscribe(value => { this.key = value; - // if (this.presetDocument) { - // this.generateImageLink(this.control.value, true); - // } } ) ) @@ -113,7 +110,7 @@ export class SentinelHubTypeComponent implements OnInit, OnChanges, AfterViewIni to = moment(_to, 'YYYY-MM-DD'); } if (/(\d+)/.test(_from)) { - from = moment(parseInt(_from, 10)); + from = moment(_from); } if (/(\d+)/.test(_to)) { to = moment(_to);