jnsdrssn
jnsdrssn
TTCTheo's Typesafe Cult
Created by jnsdrssn on 11/13/2022 in #questions
How to handle Primsa DateType (JS Date) in getStaticProps | getServersideProps
I keep running into serialization issues when working with schemas that include a DateType since they are transformed into JS Date which is not JSON serializable. Atm I am transforming the Dates into numbers (miliseconds) to then pass to the component. But of course typescript is complaining. I wrote a generic that replaces Date types with number types inside another type but so far this does not work for nested types. There has to be a better way. Pls help.
4 replies