@@ -41,6 +41,7 @@ import org.json.JSONException
4141import org.json.JSONObject
4242import java.lang.Exception
4343import java.nio.charset.Charset
44+ import java.time.Instant
4445import java.time.OffsetDateTime
4546import java.util.*
4647
@@ -750,14 +751,14 @@ class AsyncCheckProvider(private val config: ConfigStore, private val dataStore:
750751
751752 if (type != TicketCheckProvider .CheckInType .EXIT ) {
752753 val validFrom = position.validFrom
753- if (validFrom != null && validFrom.isAfter(OffsetDateTime .now ())) {
754+ if (validFrom != null && validFrom.isAfter(javaTimeNow ())) {
754755 res.type = TicketCheckProvider .CheckResult .Type .INVALID_TIME
755756 res.isCheckinAllowed = false
756757 storeFailedCheckin(eventSlug, list.serverId, " invalid_time" , position.secret!! , type, position = position.serverId, item = positionItem.serverId, variation = position.variationServerId, subevent = position.subEventServerId, nonce = nonce)
757758 return res
758759 }
759760 val validUntil = position.validUntil
760- if (validUntil != null && validUntil.isBefore(OffsetDateTime .now ())) {
761+ if (validUntil != null && validUntil.isBefore(javaTimeNow ())) {
761762 res.type = TicketCheckProvider .CheckResult .Type .INVALID_TIME
762763 res.isCheckinAllowed = false
763764 storeFailedCheckin(eventSlug, list.serverId, " invalid_time" , position.secret!! , type, position = position.serverId, item = positionItem.serverId, variation = position.variationServerId, subevent = position.subEventServerId, nonce = nonce)
@@ -1239,6 +1240,13 @@ class AsyncCheckProvider(private val config: ConfigStore, private val dataStore:
12391240 return overrideNow ? : DateTime ()
12401241 }
12411242
1243+ private fun javaTimeNow (): OffsetDateTime {
1244+ val jodaNow = now()
1245+ val instant = Instant .ofEpochMilli(jodaNow.millis)
1246+ val zoneId = jodaNow.zone.toTimeZone().toZoneId()
1247+ return OffsetDateTime .ofInstant(instant, zoneId)
1248+ }
1249+
12421250 private val CheckIn .fullDatetime : DateTime
12431251 get() {
12441252 // To avoid Joda Time code in the models, handle the case where we don't have a datetime value from JSON here
0 commit comments