Paul Woitaschek
06/27/2021, 10:24 AMNikita Khlebushkin
07/16/2021, 6:12 PMjava.lang.NoSuchFieldError: No field MIN of type Lj$/time/Instant; in class Lj$/time/Instant; or its superclasses (declaration of 'j$.time.Instant' appears in /data/app/my.app-Rumayx4kmF4yH-665uzCBw==/base.apk!classes2.dex)
at kotlinx.datetime.Instant.<clinit>(Instant.kt:96)
at kotlinx.datetime.Clock$System.now(Clock.kt:17)
The line where it happens:
val fetchStartEpoch = clock.now().toEpochMilliseconds()
I tried with datetime 0.1.1 and 0.2.1, same result.
Another interesting detail is that it only happened after I added
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
I had to add it after the library started to crash on Android 26. Any clues how I can deal with it?Imran/Malic
08/22/2021, 2:10 PMOffsetDateTime
?
And is there a snapshot release somewhere?Nick
08/26/2021, 9:16 PMDesmond van der Meer
08/31/2021, 6:39 AMTimeZone.of("Europe/Amsterdam")
, but that is not recognized during unit tests in JS (a IllegalTimeZoneException
is thrown), presumably because it can't find some asset/resource with time zone information? Is this a known issue, does anyone know how to solve this?
The time zone can be found without problem when I run the code normallyYang
09/08/2021, 10:52 AMZhiqiang Bian
09/28/2021, 6:48 PMkotlinx-datetime
for KMM development.
In my androidApp/build.gradle.kts
, if I set debuggable
to true
, then it works well. But if I set debuggable
to false
(for release), the app will crash immediately when executing any kotlinx-datetime
code (in common folder).
Does anyone know the reason?chi
12/07/2021, 8:07 PMLocalDateTime
or Instant
string parsing methods failjim
12/13/2021, 9:36 AMimplementation(npm("@js-joda/timezone", "2.3.0"))
to my jsMain
dependencies, and also added a block to the beginning of my Main.kt
file:
@JsModule("@js-joda/timezone")
@JsNonModule
external object JsJodaTimeZoneModule
private val jsJodaTz = JsJodaTimeZoneModule
I build with jsBrowserDistribution
but if I look at the build output javascript file, the very first few lines are:
(function (root, factory) {
if (typeof define === 'function' && define.amd)
define(['exports', '@js-joda/timezone', '@js-joda/core'], factory);
else if (typeof exports === 'object')
factory(module.exports, require('@js-joda/timezone'), require('@js-joda/core'));
else {
if (typeof JsJodaTimeZoneModule === 'undefined') {
throw new Error("Error loading module 'turntaker-js'. Its dependency '@js-joda/timezone' was not found. Please, check whether '@js-joda/timezone' is loaded prior to 'turntaker-js'.");
}if (typeof this['@js-joda/core'] === 'undefined') {
throw new Error("Error loading module 'turntaker-js'. Its dependency '@js-joda/core' was not found. Please, check whether '@js-joda/core' is loaded prior to 'turntaker-js'.");
}root['turntaker-js'] = factory(typeof this['turntaker-js'] === 'undefined' ? {} : this['turntaker-js'], JsJodaTimeZoneModule, this['@js-joda/core']);
}
}(this, function (_, JsJodaTimeZoneModule, $module$_js_joda_core) {
which would seem to imply that the JsJodaTimeZoneModule is not being included, or certainly not being included prior to the check runningTristan
12/15/2021, 6:59 PMplugins {
kotlin("js") version "1.5.10"
}
repositories {
mavenCentral()
}
kotlin {
js(IR) {
binaries.executable()
browser()
}
sourceSets {
val main by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.1")
}
}
}
}
But when I try to compile, I get this error
> Task :compileKotlinJs FAILED
e: java.lang.AssertionError: Built-in class kotlin.Unit is not found
How should I import this?
Thanks for your help.ptsiogas
01/24/2022, 3:42 PMjean
01/26/2022, 10:21 AM2021-11-29T23:00:00.000+0000
to it’s equivalent in another time zone?
I tried this :
internal fun String.localDateTime(): LocalDateTime = Instant.parseWithBasicOffset(this) //parseWithBasicOffset is a custom parse due to time zone written without ":"
.toLocalDateTime(TimeZone.currentSystemDefault())
but myString.localDateTime().toString()
returns 2021-11-30T00:00
the date is correct but I lost the time zone there, which I need for further processing.
So my question is : how do I go from 2021-11-29T23:00:00.000+0000
to 2021-11-30T00:00:00.000+0100
(or eventually +01:00
)jean
02/14/2022, 2:20 PMClock.System.now()
.minus(1, DateTimeUnit.DAY, TimeZone.of(timeZoneId))
I just realized that now
is also relative to my personal timezone, isn’t? I could ask for the now value of japan for example, which is way different that mine. So why doesn’t now
take a Timezone parameter? Or did I miss something?brabo-hi
02/17/2022, 6:56 AMClock.System.now()
Fatal Exception: java.lang.NoClassDefFoundError
kotlinx.datetime.Instant
kotlinx.datetime.Clock$System.now (Clock.kt:17)
mkrussel
02/24/2022, 8:05 PMandylamax
03/23/2022, 11:47 AMLocalDate
, LocalDateTime
and Instant
with @JsExport
, At the moment, we can't use itKonstantin Zolotov
04/22/2022, 2:50 PMLocalDateTime
to the beginning of the day?
So far I see only the option localDateTime.date.atTime(0, 0)
, is this the way? :mandalorian:Paul Woitaschek
05/05/2022, 9:31 AM> Task :uniqueId:linkDebugTestIosSimulatorArm64 FAILED
e: Compilation failed: Unexpected IrType kind: KIND_NOT_SET
* Source files:
* Compiler version info: Konan: 1.6.21 / Kotlin: 1.6.21
* Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: Unexpected IrType kind: KIND_NOT_SET
Dmitry Khalanskiy [JB]
06/24/2022, 1:49 PMLocalTime
, a representation of time-of-day, is now provided (a contribution by https://github.com/bishiboosh).Akram Bensalem
06/28/2022, 11:28 AMAkram Bensalem
07/19/2022, 1:36 PMval date = DateTimeFormatter
.ofPattern(pattern)
.withZone(zoneId)
.format(date.toJavaInstant())
I don't want it to return the default language of the systemkevin.cianfarini
07/27/2022, 4:38 PMClock
isn’t a fun interface
?humblehacker
08/12/2022, 8:52 PMLocalDate
, how do I format it as a localized string? java.time.LocalDate()
has a format()
method, but the kotlinx version doesn't, and so far my google searches are unsuccessful.kevin.cianfarini
08/17/2022, 1:22 PMTimeZone.UTC
just yield a 'Z'
? This was violating a backend contract we have and took me by surprise. Doing TimeZone.of("UTC")
fixed this.andylamax
08/24/2022, 7:43 AMVsevolod Tolstopyatov [JB]
10/19/2022, 4:15 PMDragos Rachieru
10/24/2022, 11:55 AMinstant.get(DateTimeUnit.HOUR)
?romainbsl
11/14/2022, 9:39 AMfarmerbb
11/23/2022, 8:24 PMjava.time.format.DateTimeFormatter
?Stylianos Gakis
12/14/2022, 12:27 PMClock
interface? Basically one where I can control the time passed myself.
Basically I’m trying to run a test where two classes receive a Clock instance, current just passing in Clock.System in, but then now()
resolves two different times but I want for the test for them to resolve on the same now.
I can probably make my own Clock instance where I just always return the same Instance, but just checking if there’s some existing artifact which gives a nice test Clock instance with some more control than what I’d do myself.Stylianos Gakis
12/14/2022, 12:27 PMClock
interface? Basically one where I can control the time passed myself.
Basically I’m trying to run a test where two classes receive a Clock instance, current just passing in Clock.System in, but then now()
resolves two different times but I want for the test for them to resolve on the same now.
I can probably make my own Clock instance where I just always return the same Instance, but just checking if there’s some existing artifact which gives a nice test Clock instance with some more control than what I’d do myself.Dmitry Khalanskiy [JB]
12/14/2022, 12:33 PMpublic class TestClock: Clock {
private var now: Instant = Clock.System.now()
public fun advanceTimeBy(duration: Duration) {
require(duration > Duration.ZERO)
now += duration
}
override fun now(): Instant = now
}
Stylianos Gakis
12/14/2022, 12:39 PMhfhbd
12/14/2022, 2:58 PMrunTest
and its `testTimeSource`:
@ExperimentalTime
public fun TimeSource.toClock(offset: Instant = Instant.fromEpochSeconds(0)): Clock = object : Clock {
private val startMark: TimeMark = markNow()
override fun now() = offset + startMark.elapsedNow()
}
Stylianos Gakis
12/14/2022, 3:01 PM