Skip to content

Commit

Permalink
fix from
Browse files Browse the repository at this point in the history
Signed-off-by: simvalery <[email protected]>
  • Loading branch information
simvalery committed Dec 10, 2024
1 parent 7785abf commit 447ff49
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
}
}
Expand All @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@

<div *ngIf="isTime(item)" class="form-field-input guardian-input-container">
<date-time-control [control]="listItem.control" [index]="i" [isMany]="true"
[item]="item"
[item]="listItem"
[showSeconds]="true" [showTime]="true"
[timeOnly]="true"></date-time-control>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
}
)
)
Expand All @@ -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);
Expand Down

0 comments on commit 447ff49

Please sign in to comment.