0

i would like to have the same algorithm on backend (jvm) and frontend (js). the algorithm needs some date/time operations and therefore will rely on some external library. for js there is something like 'moment' for jvm there is standard 'java.time'.

i figured out the only way to do it would be to use 'Platform-Specific Declarations' and basically implement the api of js library in java or the other way around (at least the parts i'm using). is it the only way or is there any cheaper/smarter approach? or the cheapest way is to write another microservice in nodejs?

piotrek
  • 13,982
  • 13
  • 79
  • 165

1 Answers1

0

Have you tried klock?

Multiplatform Date and time library for Kotlin https://korlibs.soywiz.com/klock/

https://github.com/korlibs/klock

dazza5000
  • 7,075
  • 9
  • 44
  • 89