package com.rooksdk.utils import java.time.LocalDate import java.time.ZonedDateTime import java.time.format.DateTimeFormatter /** * RookDateTime is a utility object for handling date-related operations. * It provides methods to format and parse dates using the ISO_LOCAL_DATE format. */ object RookDateTime { private val rookDateFormatter: DateTimeFormatter get() = DateTimeFormatter.ISO_LOCAL_DATE private val rookZonedDateTimeFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME /** * A DateTimeFormatter using the ISO_LOCAL_DATE pattern (e.g., "YYYY-MM-DD"). * It formats or parses dates in the standard ISO 8601 format. */ fun stringToLocalDate(string: String): LocalDate { return LocalDate.parse(string, rookDateFormatter) } fun stringToZonedDateTime(string: String): ZonedDateTime { return ZonedDateTime.parse(string, rookZonedDateTimeFormatter) } }