Daniel Rendox
08/07/2023, 5:50 PMkevin.cianfarini
08/08/2023, 1:23 PMSteven Wang
08/08/2023, 9:49 PMPriyabrata Naskar
08/10/2023, 2:59 PMLoe
08/14/2023, 3:52 PMkotlinx.datetime.LocalDate
?Travis Griggs
08/16/2023, 7:46 PM"No Name (created: ${DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM).format(oid.date.toJavaInstant())})"
oid.date returns an x instance, i threw in the toJavaInstant to use the DateTimeFormatter. I'm skimming through the docs, I haven't yet found if there's a kotlinx replacement for formatting/printing? Should I keep looking?Travis Griggs
08/16/2023, 8:21 PMColton Idle
08/21/2023, 6:07 PMSystem.currentTimeMillis()
in kotlinx.datetime would be Clock.now().toEpochMilliseconds
?kevin.cianfarini
08/22/2023, 2:57 PMClock
? Maybe they could be as simple as:
class StaticFakeClock(private val now: Instant) {
override fun now(): Instant = now
}
class DynamicFakeClock(val times: ArrayDeque<Instant>) {
override fun now(): Instant = times.removeFirst()
}
This could potentially also provide reference implementations for a clock that integrates with the coroutines test time source? That seems to be a really common question that pops up in this slack.ilya.gorbunov
09/01/2023, 4:26 PM윤동환
09/07/2023, 2:09 PM윤동환
09/10/2023, 11:59 AMkevin.cianfarini
10/03/2023, 9:53 PM24:00
as midnight corresponding to the instant occuring at the end of a calendar day.
Is there any way we could support doing such a thing in kotlinx-datetime? Currently, it's impossible to model an open end range of data that spans from midnight to midnight with local times, for example, because of this.
LocalTime(hour = 0, minute = 0) ..< LocalTime(hour = 24, minute = 0) // invalid
LocalTime(hour = 0, minute = 0) ..< LocalTime(hour = 0, minute = 0) // empty range
LocalTime(hour = 0, minute = 0) ..< LocalTime(hour = 23, minute = 59, second = 59, nanosecond = 999999) // technically incorrect
I'm happy to open a github issue if the discussion should continue there.holgerbrandl
10/23/2023, 6:46 AMNumber.seconds
but just Double.seconds
?rocketraman
10/23/2023, 10:27 PMLocalTime
(or LocalDateTime
or even Instant
) are comparing as true
? Huh?
val a = LocalTime(21, 0)..LocalTime(9, 0)
val b = LocalTime(22, 0)..LocalTime(9, 15)
// true ??
println(a == b)
holgerbrandl
10/27/2023, 11:53 AMMikolaj
11/02/2023, 10:14 AM02.11.2023
and 02.11.2023 11:15
)Sam Stone
11/06/2023, 12:14 AMkurt_steiner
11/23/2023, 12:51 PMval CURRENT_TIME_ZONE = TimeZone.currentSystemDefault()
fun now() = Clock.System.now().toLocalDateTime(CURRENT_TIME_ZONE).toInstant(TimeZone.UTC)
my timezone is asia/shanghai, and the test code is
fun `test now instant`() {
val nowInstant = now()
println(nowInstant)
println(CURRENT_TIME_ZONE)
}
the result is
2023-11-23T20:50:06.707128450Z
Asia/Shanghai
it is ok, but when using this now
in the application, everything goes wrong
how can I fix it ?Colton Idle
12/12/2023, 3:43 AM08:00:00/13:00:00
is a valid 8601 format for representing start + end time. Does anyone know how I'd parse that using kotlinx-datetime to get my start and end time... or maybe duration?
(all I want to do is see if the current local time is within that string format of start/end)kurt_steiner
12/16/2023, 2:04 PMval CURRENT_TIME_ZONE = TimeZone.of("Asia/Shanghai")
fun shanghaiNow() = Clock.System.now().toLocalDateTime(CURRENT_TIME_ZONE).toInstant(UtcOffset(hours = 8))
but I found that, when creating it many times, the length of them are not the same,
do you know how to fix it ?Slackbot
12/28/2023, 10:55 AMCharann
01/02/2024, 11:16 AMRaed 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!
Slack Conversationkevin.cianfarini
01/15/2024, 2:25 PM0.1.0
release. https://github.com/kevincianfarini/cardiologistkurt_steiner
02/22/2024, 3:45 PMLocalDate
?
val iso8601String = "2024-02-09T19:33:16.744083"
rocketraman
02/27/2024, 1:20 PMDmitry Khalanskiy [JB]
02/29/2024, 12:48 PMDmitry Khalanskiy [JB]
03/01/2024, 3:08 PMkotlinx-datetime
.PHondogo
03/16/2024, 3:24 PM