Raed Ghazal
01/06/2024, 11:23 AMjava.datetime
and kotlinx.datetime
since java had much more functionalities
you can find it here https://github.com/RaedGhazal/kotlinx-datetime-ext with full documentation on what it provides and how to use it
initially I just wrote a blog post on how to write you own helper functions but then thought of making it even easier by creating the library, will appreciate your support by giving me feedback, opening issues or even contribute! (leaving a star can be also nice ❤️)
Thanks!Robert Jaros
01/06/2024, 12:02 PMRaed Ghazal
01/06/2024, 12:07 PMPeter
01/06/2024, 1:57 PMval afterFiveDays = localDateTime.plus(5, DateTimeUnit.DAY)
I think kotlinx has this feature:
val afterFiveDays = localDateTime + 5.days
Raed Ghazal
01/06/2024, 1:58 PMPeter
01/06/2024, 1:58 PMPeter
01/06/2024, 1:58 PMRaed Ghazal
01/06/2024, 2:03 PMval afterFiveDays = localDateTime + 5.days
this won’t work actually
what + 5.days
will only work with instants, so you have to convert to instant, do the math, convert back to localdatetimeRaed Ghazal
01/06/2024, 2:03 PMval afterFiveDays = localDateTime.plus(5, DateTimeUnit.DAY)
Peter
01/06/2024, 2:21 PMRaed Ghazal
01/06/2024, 2:22 PMRaed Ghazal
01/06/2024, 2:27 PMval afterFiveDays = localDateTime + 5.days
to my library, I’m just checking something quick, hold onPeter
01/06/2024, 2:28 PMRaed Ghazal
01/06/2024, 7:34 PM1.0.2
Peter
01/06/2024, 7:37 PMRaed Ghazal
01/07/2024, 9:49 AMRobert Jaros
01/07/2024, 9:51 AMRobert Jaros
01/07/2024, 9:51 AMRaed Ghazal
01/07/2024, 9:53 AMRobert Jaros
01/07/2024, 9:55 AMjsMain
) should be supported as well (wasm is still experimental and js is stable)Raed Ghazal
01/08/2024, 10:17 AM