Skip to content

Commit

Permalink
More time fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownJoe796 committed Aug 5, 2024
1 parent d773c31 commit 8f6a215
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ data class ZonedDateTime(val dateTime: LocalDateTime, val zone: TimeZone) {
override fun toString(): String = "$dateTime${zone.offsetAt(dateTime.toInstant(zone))}[${zone.id}]"
companion object {
fun parse(string: String): ZonedDateTime {
var dateTimeFinishedIndex = string.indexOfAny(charArrayOf('Z', '[', '+', '-'), 17)
var dateTimeFinishedIndex = string.indexOfAny(charArrayOf('Z', '[', '+', '-'), 14)
if(dateTimeFinishedIndex == -1) dateTimeFinishedIndex = string.length
return ZonedDateTime(
LocalDateTime.parse(string.substring(0, dateTimeFinishedIndex)),
Expand Down Expand Up @@ -58,7 +58,7 @@ data class OffsetDateTime(val dateTime: LocalDateTime, val offset: UtcOffset) {
override fun toString(): String = "$dateTime$offset"
companion object {
fun parse(string: String): OffsetDateTime {
var dateTimeFinishedIndex = string.indexOfAny(charArrayOf('Z', '[', '+', '-'), 19)
var dateTimeFinishedIndex = string.indexOfAny(charArrayOf('Z', '[', '+', '-'), 14)
if(dateTimeFinishedIndex == -1) dateTimeFinishedIndex = string.length
return OffsetDateTime(
LocalDateTime.parse(string.substring(0, dateTimeFinishedIndex)),
Expand Down

0 comments on commit 8f6a215

Please sign in to comment.