fixed datetime handling
This commit is contained in:
@@ -55,7 +55,7 @@ func (e eventDataDB) EventWithAvailabilities() (EventWithAvailabilities, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EventCreate struct {
|
type EventCreate struct {
|
||||||
Date string `db:"date" json:"date" validate:"required"`
|
Date string `db:"date" json:"date" validate:"required,datetime=2006-01-02T15:04:05.999999999Z"`
|
||||||
Description string `db:"description" json:"description"`
|
Description string `db:"description" json:"description"`
|
||||||
Tasks []int `json:"tasks" validate:"required,min=1"`
|
Tasks []int `json:"tasks" validate:"required,min=1"`
|
||||||
}
|
}
|
||||||
|
|||||||
1153
client/package-lock.json
generated
1153
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,15 +9,13 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@internationalized/date": "3.6.0",
|
||||||
"@carbon/icons-react": "^11.53.0",
|
"@carbon/icons-react": "^11.53.0",
|
||||||
"@internationalized/date": "^3.6.0",
|
"@heroui/react": "^2.6.14",
|
||||||
"@heroui/react": "2.6.13",
|
|
||||||
"@heroui/system": "2.4.6",
|
|
||||||
"@heroui/theme": "2.4.5",
|
|
||||||
"@react-aria/i18n": "^3.12.4",
|
"@react-aria/i18n": "^3.12.4",
|
||||||
"@react-stately/data": "^3.12.0",
|
"@react-stately/data": "^3.12.0",
|
||||||
"framer-motion": "^11.15.0",
|
"framer-motion": "^12.0.0",
|
||||||
"next": "15.1.3",
|
"next": "^15.1.5",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"zustand": "^5.0.2"
|
"zustand": "^5.0.2"
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
getLocalTimeZone,
|
getLocalTimeZone,
|
||||||
now,
|
now,
|
||||||
parseAbsoluteToLocal,
|
parseAbsoluteToLocal,
|
||||||
|
ZonedDateTime,
|
||||||
} from "@internationalized/date";
|
} from "@internationalized/date";
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CheckboxGroup,
|
CheckboxGroup,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
DateValue,
|
|
||||||
Form,
|
Form,
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
@@ -36,7 +36,7 @@ export default function EventEditor(props: {
|
|||||||
onOpenChange: (isOpen: boolean) => void;
|
onOpenChange: (isOpen: boolean) => void;
|
||||||
onSubmit?: (data: EventSubmitData) => void;
|
onSubmit?: (data: EventSubmitData) => void;
|
||||||
}) {
|
}) {
|
||||||
const [date, setDate] = useState<DateValue>(
|
const [date, setDate] = useState<ZonedDateTime | null>(
|
||||||
!!props.value?.date
|
!!props.value?.date
|
||||||
? parseAbsoluteToLocal(props.value?.date)
|
? parseAbsoluteToLocal(props.value?.date)
|
||||||
: now(getLocalTimeZone()),
|
: now(getLocalTimeZone()),
|
||||||
@@ -50,7 +50,7 @@ export default function EventEditor(props: {
|
|||||||
const tasks = zustand((state) => state.tasks);
|
const tasks = zustand((state) => state.tasks);
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
if (!!props.onSubmit) {
|
if (!!props.onSubmit && !!date) {
|
||||||
props.onSubmit({
|
props.onSubmit({
|
||||||
id: props.value?.id ?? -1,
|
id: props.value?.id ?? -1,
|
||||||
date: date.toAbsoluteString(),
|
date: date.toAbsoluteString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user