Hello,
Do you provide either a date range validator or a best practice for ensuring selected dates are valid. I am looking for a client side approach.
A use case is a user selects a date range that is too low for a DateTime but valid for a DateTime2.
I have been looking in both your documentation as well as community posts and have not seen any direction on this.
Thanks
Hi @prvlion,
You can try using two RadzenCompareValidator components - set the operator of the first to GreaterThanEqual and the second to LessThanEqual.
This worked for me.
<div style="margin-bottom: 1rem" class="row">
<div class="col-md-3">
<RadzenLabel Text="StartDate" Component="StartDate" style="width: 100%">
</RadzenLabel>
</div>
<div class="col-md-9">
<RadzenDatePicker @bind-Value=@(model.StartDate) Name="StartDate" />
</div>
</div>
<div style="margin-bottom: 1rem" class="row">
<div class="col-md-3">
<RadzenLabel Text="End Date" Component="EndDate" style="width: 100%">
</RadzenLabel>
</div>
<div class="col-md-9">
<RadzenDatePicker @bind-Value=@(model.EndDate) Name="EndDate" />
<RadzenCompareValidator Operator="CompareOperator.GreaterThan" Value=@model.StartDate Component="EndDate" Text="Start date can't be greater than end date." Style="display:block" />
</div>
</div>