Effect CommunityEC
Effect Community2y ago
98 replies
Nanniiii

Transforming Nested Date Fields to Strings in Structs for Backend Compatibility

My app is using Date for the fields Date (out datepicker need Date instances) but the back expect String format. i was wondering if it was possible de make a transform that would take a struct and convert the date to string format (could be nested keys in structs) or if it would be easier to not use effect/schema for that and just do a old recursive function that goes through the obj et looses types?

because i feel like making a generic transform that would apply to nested field will be a pain type wise :/

knowing we have 2 transform, to Date and DateTime so need to target specific fields to transform

i could extend the schema i already have for the app but that's a lot of extend / struct / mutable / etc and would mean i need to duplicate all my schema with dates in it so was looking into an helper/transform that i could apply to all of those instead of specific schema everytime if possible.
Was this page helpful?