0

I have such code:

<mat-form-field class="example-full-width">
                <input
                  [matDatepicker]="picker"
                  formControlName="from"
                  matInput
                />
                <mat-datepicker-toggle [for]="picker" matSuffix></mat-datepicker-toggle>
                <mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<div>{{element.get('from').value.toISOString()}}</div>
<div>{{element.get('from').value}}</div>
this._formBuilder.group({
        from: [moment(source.from).local()]
})

I want that user will work with local timezone, but on server I want to send zero UTC offset.
Initially, it shows the correct date
enter image description here
But when I choose a different date from datepicker, it clears timezone from date for some reason. I don't need it.
enter image description here
Why it can be happening?

1 Answer 1

0

That was because of moment.tz.setDefault

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.