Compare commits

..

44 Commits

Author SHA1 Message Date
renovate[bot]
4843f89a96 Merge 1302f7f635 into 49f852f27e 2024-03-08 01:02:59 +00:00
renovate[bot]
1302f7f635 Update dependency com.soywiz.korge:korlibs-time to v5.4.0 2024-03-08 01:02:56 +00:00
49f852f27e Merge pull request #101 from InsanusMokrassar/renovate/dokka_version
Update plugin org.jetbrains.dokka to v1.9.20
2024-03-05 13:56:26 +06:00
renovate[bot]
470dc92f54 Update plugin org.jetbrains.dokka to v1.9.20 2024-03-05 02:59:24 +00:00
b5dcdc185f Merge pull request #99 from InsanusMokrassar/2.2.8
2.2.8
2024-02-18 22:24:34 +06:00
8df9f9c086 update dependencies 2024-02-18 22:14:01 +06:00
484f46223f start 2.2.8 2024-02-18 21:56:06 +06:00
1ce654fa06 Merge pull request #94 from InsanusMokrassar/2.2.7
2.2.7
2024-01-31 17:56:23 +06:00
6da04f54da update dependencies 2024-01-31 17:40:15 +06:00
e1d716688a start 2.2.7 2024-01-31 17:26:48 +06:00
e247de9e24 Merge pull request #92 from InsanusMokrassar/2.2.6
2.2.6
2024-01-12 14:52:32 +06:00
a153bc7996 update klock 2024-01-12 14:45:14 +06:00
9753cda961 start 2.2.6 2024-01-12 14:33:22 +06:00
e8ef6e6935 update publication script 2023-12-28 15:51:33 +06:00
b41bf0ea07 Merge pull request #91 from InsanusMokrassar/2.2.5
2.2.5
2023-12-28 15:47:39 +06:00
09d811e2c4 Update CHANGELOG.md 2023-12-28 15:47:27 +06:00
3faadefced update dependencies 2023-12-27 19:15:35 +06:00
f3883a8678 start 2.2.5 2023-12-27 01:14:50 +06:00
5ff02a2a9d Merge pull request #85 from InsanusMokrassar/2.2.4
2.2.4
2023-11-26 21:23:18 +06:00
f56215ee10 start 2.2.4 and update dependencies 2023-11-26 21:20:39 +06:00
e66acb34de Update kdocs.yml 2023-11-03 00:31:23 +06:00
78ac446311 Update publishing_packages.yml 2023-11-03 00:31:12 +06:00
697b4e81b8 Merge pull request #81 from InsanusMokrassar/2.2.3
2.2.3
2023-11-02 23:28:22 +06:00
d1288de032 build fixes 2023-11-02 23:27:53 +06:00
eb867e7366 update dependencies and gradle environment 2023-11-02 23:22:19 +06:00
4aa10e00cf start 2.2.3 2023-11-02 23:19:24 +06:00
170d443517 Merge pull request #80 from InsanusMokrassar/2.2.2
2.2.2
2023-10-23 01:27:57 +06:00
d1aab7ccd6 add arm target 2023-10-23 01:27:19 +06:00
58d758f141 Update gradle-wrapper.properties 2023-10-23 01:27:19 +06:00
71bd3f0eb4 update dependencies 2023-10-23 01:27:19 +06:00
bd2a852b16 start 2.2.2 2023-10-23 01:27:19 +06:00
8e844b5875 update kotlinx serialization 2023-10-23 01:26:17 +06:00
e0f7dddf42 update dependencies 2023-10-23 01:26:17 +06:00
d64acc9806 potential fix of #65 2023-10-23 01:26:17 +06:00
58375452c7 start 2.2.1 2023-10-23 01:26:17 +06:00
cbfbdc1b33 files replacements 2023-08-09 13:01:20 +06:00
715d414f51 update dependencies 2023-08-09 12:35:13 +06:00
2ecd8c4292 start 2.2.0 2023-08-09 12:24:41 +06:00
1be8d947f7 Merge pull request #67 from InsanusMokrassar/2.1.2
2.1.2
2023-07-05 20:07:15 +06:00
f66c1c2477 remove redundant change in string parse change 2023-07-05 20:05:39 +06:00
69cf7afd4e make inline functions callbacks inline again 2023-07-02 16:41:52 +06:00
92df91edd3 update coroutines 2023-07-02 16:06:47 +06:00
f7a388f438 start 2.1.2 2023-07-02 16:05:46 +06:00
9a10c7eb87 Merge pull request #64 from InsanusMokrassar/2.1.1
2.1.1
2023-06-20 11:44:13 +06:00
45 changed files with 145 additions and 55 deletions

View File

@@ -10,10 +10,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v1
with: with:
java-version: 11 java-version: 17
- name: Fix android 32.0.0 dx
continue-on-error: true
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && cp d8 dx && cd lib && cp d8.jar dx.jar
- name: Build - name: Build
run: ./gradlew dokkaHtml run: ./gradlew dokkaHtml
- name: Publish KDocs - name: Publish KDocs

View File

@@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v1
with: with:
java-version: 11 java-version: 17
- name: Update version - name: Update version
run: | run: |
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`" branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"

View File

@@ -1,5 +1,69 @@
# Changelog # Changelog
## 2.2.8
* `Version`:
* `Coroutines`: `1.8.0`
## 2.2.7
* `Version`:
* `Klock`: `5.3.1`
* `AndroidXWork`: `2.9.0`
## 2.2.6
**Since this version klock depdendency replaced with `com.soywiz.korge:korlibs-time`**
* `Version`:
* `Klock`: `5.3.0`
## 2.2.5
* `Versions`
* `Kotlin`: `1.9.22`
* `Serialization`: `1.6.2`
## 2.2.4
* `Versions`
* `Kotlin`: `1.9.21`
* `Serialization`: `1.6.1`
## 2.2.3
**THIS UPDATE CONTAINS UPGRADE OF USED JDK UP TO 17**
* Versions
* `Kotlin`: `1.9.20`
## 2.2.2
* Versions
* `Kotlin`: `1.9.20-RC`
* `Android` (min/target): `34`
## 2.2.1
* Potential fix of [#65](https://github.com/InsanusMokrassar/krontab/issues/65)
* Versions
* `Kotlin`: `1.9.20-Beta`
* `Klock`: `4.0.10`
* `Serialization`: `1.6.0`
## 2.2.0
* Versions
* `Kotlin`: `1.9.0`
* `Coroutines`: `1.7.3`
* `Klock`: `4.0.9`
## 2.1.2
* Versions
* `Coroutines`: `1.7.2`
* All callbacks for standard extensions like `doInfinity` now fully inline
## 2.1.1 ## 2.1.1
* `asFlowWithoutDelays` and `asTzFlowWithoutDelays` will have nullable `since` parameters with default to `null` * `asFlowWithoutDelays` and `asTzFlowWithoutDelays` will have nullable `since` parameters with default to `null`

View File

@@ -61,6 +61,7 @@ kotlin {
} }
linuxX64() linuxX64()
mingwX64() mingwX64()
linuxArm64()
sourceSets { sourceSets {
@@ -70,7 +71,7 @@ kotlin {
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialization_version" api "org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialization_version"
api "com.soywiz.korlibs.klock:klock:$klockVersion" api "com.soywiz.korge:korlibs-time:$klockVersion"
} }
} }
@@ -97,7 +98,7 @@ kotlin {
implementation kotlin('test-js') implementation kotlin('test-js')
} }
} }
androidTest { androidUnitTest {
dependencies { dependencies {
implementation kotlin('test-junit') implementation kotlin('test-junit')
} }
@@ -109,7 +110,7 @@ apply plugin: 'com.getkeepsafe.dexcount'
android { android {
compileSdk "$android_compileSdkVersion".toInteger() compileSdk "$android_compileSdkVersion".toInteger()
buildToolsVersion "$android_buildToolsVersion" buildToolsVersion = "$android_buildToolsVersion"
namespace "${group}.${project.name}" namespace "${group}.${project.name}"
defaultConfig { defaultConfig {
@@ -128,8 +129,8 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_17
} }
sourceSets { sourceSets {
@@ -141,6 +142,6 @@ android {
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_17
} }

View File

@@ -18,13 +18,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
githubRelease { githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}" token "${project.property('GITHUB_RELEASE_TOKEN')}"
owner "InsanusMokrassar" owner = "InsanusMokrassar"
repo "${rootProject.name}" repo = "${rootProject.name}"
tagName "v${project.version}" tagName = "v${project.version}"
releaseName "${project.version}" releaseName = "${project.version}"
targetCommitish "${project.version}" targetCommitish = "${project.version}"
body getCurrentVersionChangelog("${project.version}") body = getCurrentVersionChangelog("${project.version}")
} }
} }

View File

@@ -9,32 +9,32 @@ android.useAndroidX=true
android.enableJetifier=false android.enableJetifier=false
kotlin_version=1.8.22 kotlin_version=1.9.22
kotlin_coroutines_version=1.6.4 kotlin_coroutines_version=1.8.0
kotlin_serialization_version=1.5.1 kotlin_serialization_version=1.6.2
dokka_version=1.8.20 dokka_version=1.9.20
klockVersion=4.0.3 klockVersion=5.4.0
## Github reease ## Github reease
github_release_plugin_version=2.4.1 github_release_plugin_version=2.5.2
## Android ## Android
android_gradle_version=7.4.2 android_gradle_version=8.1.4
android_minSdkVersion=21 android_minSdkVersion=21
android_compileSdkVersion=33 android_compileSdkVersion=34
android_buildToolsVersion=33.0.2 android_buildToolsVersion=34.0.0
dexcount_version=4.0.0 dexcount_version=4.0.0
junit_version=4.12 junit_version=4.12
test_ext_junit_version=1.1.3 test_ext_junit_version=1.1.3
espresso_core=3.4.0 espresso_core=3.4.0
androidx_work_version=2.8.1 androidx_work_version=2.9.0
## Common ## Common
version=2.1.1 version=2.2.8
android_code_version=28 android_code_version=38

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip

View File

@@ -1,7 +1,7 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
task javadocsJar(type: Jar) { task javadocsJar(type: Jar) {
classifier = 'javadoc' archiveClassifier = 'javadoc'
} }
publishing { publishing {
@@ -50,18 +50,14 @@ publishing {
} }
} }
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) { if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
maven { maven {
name = "Gitea" name = "InmoNexus"
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven") url = uri("https://nexus.inmo.dev/repository/maven-releases/")
credentials(HttpHeaderCredentials) { credentials {
name = "Authorization" username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN') password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
}
authentication {
header(HttpHeaderAuthentication)
} }
} }
@@ -96,4 +92,27 @@ if (project.hasProperty("signing.gnupg.keyName")) {
dependsOn(it) dependsOn(it)
} }
} }
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
mustRunAfter(signingTasks)
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def testTask = tasks.findByName("compileTestKotlin$pubName")
if (testTask != null) {
signTask.mustRunAfter(testTask)
}
}
} }

View File

@@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/krontab/blob/master/LICENSE"}],"mavenConfig":{"name":"Krontab","description":"It is an analog of crontab util for Kotlin Coroutines","url":"https://github.com/InsanusMokrassar/krontab","vcsUrl":"https://github.com/InsanusMokrassar/krontab.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/krontab"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} {"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/krontab/blob/master/LICENSE"}],"mavenConfig":{"name":"Krontab","description":"It is an analog of crontab util for Kotlin Coroutines","url":"https://github.com/InsanusMokrassar/krontab","vcsUrl":"https://github.com/InsanusMokrassar/krontab.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/krontab"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}

View File

@@ -3,6 +3,7 @@ package dev.inmo.krontab
import android.content.Context import android.content.Context
import androidx.work.* import androidx.work.*
import korlibs.time.DateTime import korlibs.time.DateTime
import korlibs.time.millisecondsLong
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
/** /**

View File

@@ -2,6 +2,7 @@ package dev.inmo.krontab
import korlibs.time.DateTime import korlibs.time.DateTime
import korlibs.time.DateTimeTz import korlibs.time.DateTimeTz
import korlibs.time.millisecondsLong
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlin.coroutines.coroutineContext import kotlin.coroutines.coroutineContext
@@ -14,7 +15,7 @@ import kotlin.coroutines.coroutineContext
* *
* WARNING!!! In case if [KronScheduler.next] of [this] instance will return null, [block] will be called immediately * WARNING!!! In case if [KronScheduler.next] of [this] instance will return null, [block] will be called immediately
*/ */
suspend inline fun <T> KronScheduler.doOnce(noinline block: suspend (DateTime) -> T): T { suspend inline fun <T> KronScheduler.doOnce(block: (DateTime) -> T): T {
val time = nextOrNow().also { val time = nextOrNow().also {
delay((it - DateTime.now()).millisecondsLong) delay((it - DateTime.now()).millisecondsLong)
} }
@@ -29,7 +30,7 @@ suspend inline fun <T> KronScheduler.doOnce(noinline block: suspend (DateTime) -
* WARNING!!! In case if [KronScheduler.next] of [this] instance will return null, [block] will be called immediately * WARNING!!! In case if [KronScheduler.next] of [this] instance will return null, [block] will be called immediately
*/ */
@Deprecated("Replaceable", ReplaceWith("doOnce", "dev.inmo.krontab.doOnce")) @Deprecated("Replaceable", ReplaceWith("doOnce", "dev.inmo.krontab.doOnce"))
suspend inline fun <T> KronScheduler.doOnceLocal(noinline block: suspend (DateTime) -> T): T = doOnce(block) suspend inline fun <T> KronScheduler.doOnceLocal(block: (DateTime) -> T): T = doOnce(block)
/** /**
* Execute [block] once at the [KronScheduler.next] time and return result of [block] calculation. * Execute [block] once at the [KronScheduler.next] time and return result of [block] calculation.
@@ -53,7 +54,7 @@ suspend inline fun <T> KronScheduler.doOnceTz(noinline block: suspend (DateTimeT
*/ */
suspend inline fun <T> doOnce( suspend inline fun <T> doOnce(
scheduleConfig: String, scheduleConfig: String,
noinline block: suspend (DateTime) -> T block: (DateTime) -> T
) = buildSchedule(scheduleConfig).doOnce(block) ) = buildSchedule(scheduleConfig).doOnce(block)
/** /**
@@ -69,7 +70,7 @@ suspend inline fun <T> doOnceTz(
/** /**
* Will execute [block] while it will return true as a result of its calculation * Will execute [block] while it will return true as a result of its calculation
*/ */
suspend inline fun KronScheduler.doWhile(noinline block: suspend (DateTime) -> Boolean) { suspend inline fun KronScheduler.doWhile(block: (DateTime) -> Boolean) {
do { do {
delay(1L) delay(1L)
} while (doOnce(block)) } while (doOnce(block))
@@ -78,7 +79,7 @@ suspend inline fun KronScheduler.doWhile(noinline block: suspend (DateTime) -> B
* Will execute [block] while it will return true as a result of its calculation * Will execute [block] while it will return true as a result of its calculation
*/ */
@Deprecated("Replaceable", ReplaceWith("doWhile", "dev.inmo.krontab.doWhile")) @Deprecated("Replaceable", ReplaceWith("doWhile", "dev.inmo.krontab.doWhile"))
suspend inline fun KronScheduler.doWhileLocal(noinline block: suspend (DateTime) -> Boolean) = doWhile(block) suspend inline fun KronScheduler.doWhileLocal(block: (DateTime) -> Boolean) = doWhile(block)
/** /**
* Will execute [block] while it will return true as a result of its calculation * Will execute [block] while it will return true as a result of its calculation
@@ -96,7 +97,7 @@ suspend inline fun KronScheduler.doWhileTz(noinline block: suspend (DateTimeTz)
*/ */
suspend inline fun doWhile( suspend inline fun doWhile(
scheduleConfig: String, scheduleConfig: String,
noinline block: suspend (DateTime) -> Boolean block: (DateTime) -> Boolean
) = buildSchedule(scheduleConfig).doWhile(block) ) = buildSchedule(scheduleConfig).doWhile(block)
/** /**
@@ -107,7 +108,7 @@ suspend inline fun doWhile(
@Deprecated("Replaceable", ReplaceWith("doWhile", "dev.inmo.krontab.doWhile")) @Deprecated("Replaceable", ReplaceWith("doWhile", "dev.inmo.krontab.doWhile"))
suspend inline fun doWhileLocal( suspend inline fun doWhileLocal(
scheduleConfig: String, scheduleConfig: String,
noinline block: suspend (DateTime) -> Boolean block: (DateTime) -> Boolean
) = doWhile(scheduleConfig, block) ) = doWhile(scheduleConfig, block)
/** /**
@@ -124,7 +125,7 @@ suspend inline fun doWhileTz(
/** /**
* Will execute [block] without any checking of result * Will execute [block] without any checking of result
*/ */
suspend inline fun KronScheduler.doInfinity(noinline block: suspend (DateTime) -> Unit) = doWhile { suspend inline fun KronScheduler.doInfinity(block: (DateTime) -> Unit) = doWhile {
block(it) block(it)
coroutineContext.isActive coroutineContext.isActive
} }
@@ -132,7 +133,7 @@ suspend inline fun KronScheduler.doInfinity(noinline block: suspend (DateTime) -
* Will execute [block] without any checking of result * Will execute [block] without any checking of result
*/ */
@Deprecated("Replaceable", ReplaceWith("doInfinity", "dev.inmo.krontab.doInfinity")) @Deprecated("Replaceable", ReplaceWith("doInfinity", "dev.inmo.krontab.doInfinity"))
suspend inline fun KronScheduler.doInfinityLocal(noinline block: suspend (DateTime) -> Unit) = doInfinity(block) suspend inline fun KronScheduler.doInfinityLocal(block: (DateTime) -> Unit) = doInfinity(block)
/** /**
* Will execute [block] without any checking of result * Will execute [block] without any checking of result
@@ -149,7 +150,7 @@ suspend inline fun KronScheduler.doInfinityTz(noinline block: suspend (DateTimeT
*/ */
suspend inline fun doInfinity( suspend inline fun doInfinity(
scheduleConfig: String, scheduleConfig: String,
noinline block: suspend (DateTime) -> Unit block: (DateTime) -> Unit
) = buildSchedule(scheduleConfig).doInfinity(block) ) = buildSchedule(scheduleConfig).doInfinity(block)
/** /**
@@ -160,7 +161,7 @@ suspend inline fun doInfinity(
@Deprecated("Replaceable", ReplaceWith("doInfinity", "dev.inmo.krontab.doInfinity")) @Deprecated("Replaceable", ReplaceWith("doInfinity", "dev.inmo.krontab.doInfinity"))
suspend inline fun doInfinityLocal( suspend inline fun doInfinityLocal(
scheduleConfig: String, scheduleConfig: String,
noinline block: suspend (DateTime) -> Unit block: (DateTime) -> Unit
) = doInfinity(scheduleConfig, block) ) = doInfinity(scheduleConfig, block)
/** /**

View File

@@ -108,13 +108,19 @@ internal fun NearDateTimeCalculatorDays(
} else { } else {
dateTime dateTime
}) })
dateTime.copy( val newDateTime = dateTime.copy(
dayOfMonth = min(dateTime.month.days(dateTime.year), newOne.toInt() + 1), // index1 dayOfMonth = min(dateTime.month.days(dateTime.year), newOne.toInt() + 1), // index1
hour = 0, hour = 0,
minute = 0, minute = 0,
second = 0, second = 0,
milliseconds = 0 milliseconds = 0
) )
// If day of month has not been changed, use old dateTime due to no changes required
if (newDateTime.dayOfMonth == dateTime.dayOfMonth) {
dateTime
} else {
newDateTime
}
} }
) )

View File

@@ -5,6 +5,7 @@ import korlibs.time.DateTimeTz
import korlibs.time.milliseconds import korlibs.time.milliseconds
import dev.inmo.krontab.KronScheduler import dev.inmo.krontab.KronScheduler
import dev.inmo.krontab.next import dev.inmo.krontab.next
import korlibs.time.millisecondsLong
import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow