I am currently trying to force my application to use UTC time no matter what the system time is. I have a method to create a date:
public static createDate(date: Date = new Date()): Date {
return new Date(
Date.UTC(
date.getUTCFullYear(),
date.getUTCMonth(),
date.getUTCDay(),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds(),
date.getUTCMilliseconds()
)
);
}
However, I get a time that is 8 hours ahead when it lands in the database. I am not sure what is going on here.
I have tried using other solutions on stack overflow, using libraries like moment and date-fns but i have not had any luck.
Dateobject (your solution "Y"), and now you're asking about problems with Y. Please read more about the XY problem. Then I suggest opening a new question about the DB parts. Tag it with prisma, typescript and date.