Skip to content

Commit

Permalink
changed date field to store ISOstring and date format
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-t06 committed May 1, 2024
1 parent 9a5f005 commit adc3560
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/user/AddFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ const AddFile = ({
const router = useRouter();
const [error, setError] = useState<boolean>(false);
const [selectedTags, setSelectedTags] = useState<TagProps[]>([]);

const handleResetState = () => {
setStartDate(new Date());
setSelectedTags([]);
Expand Down Expand Up @@ -175,7 +174,7 @@ const AddFile = ({
className="mb-4 h-12 w-full cursor-pointer rounded-lg pl-4"
selected={startDate}
onChange={(date) => date && setStartDate(date)}
dateFormat="dd MMMM yyyy"
dateFormat="YYYY-MM-dd"
excludeDates={excludeDates}
/>
{excludedDatesString.includes(startDate.toDateString()) ? (
Expand Down
1 change: 1 addition & 0 deletions src/server/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const File = z.object({
date: z.string().transform((val) => {
const date = new Date(val);
date.setHours(0, 0, 0, 0);
date.toISOString();
return date;
}),
filetype: z.string(),
Expand Down

0 comments on commit adc3560

Please sign in to comment.