Fix date
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-01-25 21:11:20 +01:00
parent 17a947ce20
commit 8655307858
2 changed files with 16 additions and 1 deletions

View File

@ -9,7 +9,7 @@
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">
<div class="card menu-card">
<h5>Date image: {{item.dataDate | date:'shortDate'}}</h5>
<h5><span>Date</span>: {{selectedDate()}}</h5>
<div class="d-flex justify-content-between">
<div>
<button *ngIf="hasPrevious()" type="button" class="btn btn-link p-0" (click)="handlePreviousTemporal($event)">

View File

@ -32,6 +32,21 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
return temporalItemLayer && temporalItemLayer.nextItemLayer != null;
}
selectedDate():string {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer.selectedItemLayer) {
if(temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) {
let sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
let ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed);
} else {
let d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate");
}
}
return "";
}
nextDate():string {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer.nextItemLayer.item) {