fix(frontend): prevent RangeError in TimeAdjuster and add validation to SleepButton
Build Frontend / build (push) Failing after 3m15s

This commit is contained in:
2026-06-02 21:20:38 +02:00
parent 13bc53ea59
commit c371a3d8e8
5 changed files with 53 additions and 0 deletions
@@ -10,6 +10,10 @@ const SleepButton: React.FC<SleepButtonProps> = ({ time }) => {
const isSleeping = !!activeSession;
const handleClick = async () => {
if (!time) {
alert('Please select a valid time.');
return;
}
try {
if (isSleeping && activeSession?.id) {
await endSession({ sessionId: activeSession.id, endTime: time });
+3
View File
@@ -90,6 +90,9 @@ export function formatDateTime(date: Date | string): string {
*/
export function toUTCFromLocalInput(inputValue: string): string {
const d = new Date(inputValue);
if (isNaN(d.getTime())) {
return "";
}
return d.toISOString();
}