I am currently working on an angular project where users are only allowed to create tasks for today or future dates using a date picker.
I have implemented the <mat-datepicker>
along with moment to disable past dates.
<mat-form-field formGroupName="user">
<mat-label>Due Date</mat-label>
<input
matInput
[min]="dueDateMin"
[matDatepicker]="picker"
(click)="picker.open()"
placeholder="Choose a date"
formControlName="date"
(dateChange)="setTaskDueDate($event.value); checkAvailableEfforts()"
required
/>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-hint>Task completion date.</mat-hint>
<mat-error>Due date is required</mat-error>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
In Component
dueDateMin = moment();
Issue: Users can bypass the date restrictions by changing the timezone of their browser.
Query: Is there a way to display an alert to users if they open the app in a different timezone than the specified one (e.g. "Asia/Calcutta" - India Timezone)?
or Force the application to use a consistent timezone regardless of the user's system timezone.
Thank you in advance!