fixed datetime handling

This commit is contained in:
z1glr
2025-01-21 10:37:06 +00:00
parent 67a4001883
commit 8ab76c7afa
4 changed files with 9838 additions and 9869 deletions

19625
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +1,36 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@carbon/icons-react": "^11.53.0",
"@internationalized/date": "^3.6.0",
"@heroui/react": "2.6.13",
"@heroui/system": "2.4.6",
"@heroui/theme": "2.4.5",
"@react-aria/i18n": "^3.12.4",
"@react-stately/data": "^3.12.0",
"framer-motion": "^11.15.0",
"next": "15.1.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zustand": "^5.0.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.1.3",
"postcss": "^8",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@internationalized/date": "3.6.0",
"@carbon/icons-react": "^11.53.0",
"@heroui/react": "^2.6.14",
"@react-aria/i18n": "^3.12.4",
"@react-stately/data": "^3.12.0",
"framer-motion": "^12.0.0",
"next": "^15.1.5",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zustand": "^5.0.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.1.3",
"postcss": "^8",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}

View File

@@ -1,14 +1,14 @@
import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import {
getLocalTimeZone,
now,
parseAbsoluteToLocal,
ZonedDateTime,
} from "@internationalized/date";
import {
Checkbox,
CheckboxGroup,
DatePicker,
DateValue,
Form,
Modal,
ModalBody,
@@ -36,7 +36,7 @@ export default function EventEditor(props: {
onOpenChange: (isOpen: boolean) => void;
onSubmit?: (data: EventSubmitData) => void;
}) {
const [date, setDate] = useState<DateValue>(
const [date, setDate] = useState<ZonedDateTime | null>(
!!props.value?.date
? parseAbsoluteToLocal(props.value?.date)
: now(getLocalTimeZone()),
@@ -50,7 +50,7 @@ export default function EventEditor(props: {
const tasks = zustand((state) => state.tasks);
function onSubmit() {
if (!!props.onSubmit) {
if (!!props.onSubmit && !!date) {
props.onSubmit({
id: props.value?.id ?? -1,
date: date.toAbsoluteString(),