hestia/src/lib/server/pothos/schema/Scalars/Date.ts
Baobeld 37d901a86c
Mutation implementations (#5)
* split up files

* timestamps, scalars and dayjs

* lib server directory

* move bun types to dev

* move storybook dark mode to dev

* got timestamps working

* fix reference

* separate schema into files and add mutations
2024-12-11 15:59:02 -05:00

14 lines
No EOL
325 B
TypeScript

import { builder } from '../../builder';
export const DateScalar = builder.scalarType('Date', {
description: 'Date Scalar in ISO format',
serialize: (date) => {
return date.toISOString();
},
parseValue: (date) => {
if (typeof date !== 'string') {
throw new Error('Cyka blyat');
}
return new Date(date);
}
});