Open kidusdev opened 5 days ago
I'll take some time to look at it. In fact, another problem has arisen. FromJson does not handle time strings correctly.
another problem has arisen. FromJson does not handle time strings correctly.
Yeah, i encountered that many time i added an extra step to parse string to dates and assigning it to the model in my apps before mentioning it here.
@kidusdev Fixed an issue with <model>.fromJson
not being able to handle DateTime.
I actually want to wait for the macros (which are coming soon) to add the copyWith
feature
Because along with that, we should not only add fromJson/toJson/copyWith
to model
, but also to input
types. So that types can be published independently for the front end to use it.
Hy
I encounter this redundant code in various places of my application
here in the above example i am grouping expenses to their lower expense period. its like if i have 1500$ house rent expense and if i have to cover that in a month how much should i earn daily and its obviously 50$ and the same for yearly expense. and the new value is treated as daily expense and the only difference is the amount. it would be great if we can do this instead;
i tried
it doesn't work because the
toJson
method changes thecreatedAt
toString
then when i use thefromJson
method is complainstype 'String' is not a subtype of type 'DateTime?'
. the DateTime Field in the models should parse aString
andDateTime
typesNB. i added the
copyWith
method to the models but it resets everytime i change the schema.prisma and generate a client