Any good approach to model `date` is shared jvm/js...
# javascript
p
Any good approach to model
date
is shared jvm/js DTO ?
đź‘€ 1
r
Depends what you need it to do. If you just need a shared interface to pass through your API boundary, an ISO-8601 string is probably good enough and you can handle it separately on each platform using the native APIs. You could also use an empty typealias for this if you want it to have the platform-native type but don’t need to call anything on it from your common code. If you want to do date-based logic from common you’ll want something a little more. One path is to define an interface or expect functions for your specific use-cases. Another is to try a common date library, eg https://github.com/erikc5000/island-time.
p
thanks! that empty typealias sounds promising, I'll dig it a bit