Jamie Grant Batchelor
Jamie Grant Batchelor

Reputation: 21

Angular 6 - Display time as actual input not UTC offset timezone

When time is input, for example: 04/01/2023 00:00:00, the matDatepicker component displays the same data but with UTC offset. Moment won't work for this application.

Here is my sample HTML

<input matInput [matDatepicker]="beginProcessingPicker" [(ngModel)]="localBeginProcessingDate" name="beginProcessing" class="form-control" placeholder="{{ localBeginProcessingDate | date:'EEE MMM dd yyyy HH:mm:ss Z':'local' }}">
              <mat-datepicker-toggle matSuffix [for]="beginProcessingPicker"></mat-datepicker-toggle>
              <mat-datepicker #beginProcessingPicker></mat-datepicker>

I have tried moment.js but can't get passed the @Pipe implementation, and it doesn't import similar to my other components so that has been confusing.

I have tried manipulating the date field but it is a property within "displayedColumns" in my .ts codebehind, which converts it into a string in an array, making manipulation of it difficult (I can create a variable as a dateTime but struggle with serving that back to the UI).

Looking into Material Moment Adapter also didn't solve anything for me and returned a load of errors

At this point I am thinking I either need to update from Angular 6.0.8 or accept that I can't do this until updating.

Upvotes: 1

Views: 76

Answers (0)

Related Questions