Skip to content

Instantly share code, notes, and snippets.

@aquarla
Created April 18, 2022 08:08
/*
* PrismaではDatetime型を取り出すときのタイムゾーンが指定できない(固定でUTC)になってしまう
* ため、強制的に9時間マイナスしてJSTに補正する
*/
export default function convertTimezone(obj) {
return {
...obj,
createdAt: new Date(Date.parse(obj.createdAt) - 1000 * 60 * 60 * 9),
updatedAt: new Date(Date.parse(obj.updatedAt) - 1000 * 60 * 60 * 9),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment