fixed datetime handling
This commit is contained in:
@@ -55,7 +55,7 @@ func (e eventDataDB) EventWithAvailabilities() (EventWithAvailabilities, error)
|
||||
}
|
||||
|
||||
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"`
|
||||
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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@internationalized/date": "3.6.0",
|
||||
"@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",
|
||||
"@heroui/react": "^2.6.14",
|
||||
"@react-aria/i18n": "^3.12.4",
|
||||
"@react-stately/data": "^3.12.0",
|
||||
"framer-motion": "^11.15.0",
|
||||
"next": "15.1.3",
|
||||
"framer-motion": "^12.0.0",
|
||||
"next": "^15.1.5",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"zustand": "^5.0.2"
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user