Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ngx-material-timepicker validation [min] not working for hours #454

Open
elisaravagnann opened this issue Sep 26, 2023 · 1 comment
Open

Comments

@elisaravagnann
Copy link

elisaravagnann commented Sep 26, 2023

I have this Issues
<ngx-timepicker-field [format]="24" [controlOnly]="true" [ngModel]="formatTime(stopDate)" [min] ="formatTime(startDate)" (ngModelChange)="onStopDateChange($event)" name="stopDate" required style="color: white !important;">


When I put the [min] validation like this ( [min] ="formatTime(startDate)" ) the hour arrows turn blocked if, although, the camp is not on the min value.

formatTime function:
formatTime(date: Date): string
{
if (!date || !(date instanceof Date)) {
return '';
}

const hours = date.getHours();
const minutes = date.getMinutes();

const formattedHours = hours.toString().padStart(2, '0');
const formattedMinutes = minutes.toString().padStart(2, '0');

return `${formattedHours}:${formattedMinutes}`;

}

@Pradeep7909
Copy link

I am facing same issue
Did you find the solution??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants