Hi, i'm facing an issue for the DatePicker component.
Frontend-code:
Backend-code:
public void ChangeDuration(TimeOnly? value)
{
DateTime calculatedDownTime = downTimeStartDate.Value.Add(value.Value.ToTimeSpan());
//Case: downtimestart + downtimeduration is greater than shiftend
if (shiftEnd <= calculatedDownTime)
{
var diff = new DateTime((shiftEnd.Value.AddHours(-downTimeStartDate.Value.Hour).AddMinutes(-downTimeStartDate.Value.Minute - 1)).Ticks);
downtimeDuration = new TimeOnly(diff.Hour, diff.Minute, 0);
downTimeEndDate = downTimeStartDate.Value.Add(downtimeDuration.Value.ToTimeSpan());
StateHasChanged();
return;
}
downtimeDuration = value.Value;
downTimeEndDate= downTimeStartDate.Value.Add(downtimeDuration.Value.ToTimeSpan());
StateHasChanged();
}
The Problem occurs if choose a value that would lead to a calculatedDownTime over my shiftEnd.
For example:
downTimeStartDate = 7:00 am
downtimeduration = 8:00h
my shiftEnd is 14:59 pm
which means that my downtimeduration can have a max value for 7:59h.
And so i set my downtimeduration.
The value is also displayed in the frontend.
But if I change the duration to 7:55h (so I only change the minutes and not the hours) the component sends the value 8:55h in the function and not 7:55h as shown in the component.
the hour has to be changed in the frontend, so it is recognized in the backend.
Is there a fix for this issue?