Class CalendarDateTimeUtils

java.lang.Object
io.jmix.fullcalendarflowui.kit.component.CalendarDateTimeUtils

public final class CalendarDateTimeUtils extends Object
INTERNAL.
  • Constructor Details

    • CalendarDateTimeUtils

      public CalendarDateTimeUtils()
  • Method Details

    • transformToType

      public static Object transformToType(Object date, Class javaType, @Nullable ZoneId zoneId)
      Converts a date instance to the passed java type corresponding to one of the date types.
      Parameters:
      date - the date object, not null
      javaType - the java type to convert to
      zoneId - the zone ID to use or null to use default system timezone
      Returns:
      the date object converted to the passed java type, not null
    • transformToZDT

      public static ZonedDateTime transformToZDT(Object date, @Nullable ZoneId fromZoneId)
      Obtains an instance of ZonedDateTime from Date or LocalDate or LocalDateTime or OffsetDateTime ZonedDateTime is created for LocalDate, LocalDateTime with default system timezone
      Parameters:
      date - date object, not null
      Returns:
      the ZonedDateTime, not null
      Throws:
      IllegalArgumentException - if the type of the provided date is not supported
    • transformToLocalTime

      public static LocalTime transformToLocalTime(Object time)
      Obtains an instance of LocalTime from Time or Date or LocalTime or OffsetTime
      Parameters:
      time - the time object to transform
      Returns:
      local time instance
      Throws:
      IllegalArgumentException - if the type of the provided time is not supported
    • parseIsoDate

      public static LocalDate parseIsoDate(String isoDate)
      Parses date from ISO string.
      Parameters:
      isoDate - date in ISO format
      Returns:
      local date instance
      Throws:
      DateTimeParseException - if the provided date cannot be parsed
    • parseIsoDateTime

      public static ZonedDateTime parseIsoDateTime(String isoDateTime, ZoneId zoneId)
      Parses date-time or date from ISO string.
      Parameters:
      isoDateTime - date-time in ISO format
      zoneId - zoneId if the provided date-time does contain time zone
      Returns:
      ZonedDateTime instance
      Throws:
      DateTimeParseException - if the provided date-time cannot be parsed
    • parseAndTransform

      public static LocalDateTime parseAndTransform(String isoDateTime, ZoneId zoneId)
      Parses raw ISO date time to ZonedDateTime with the zoneId and then transform this value to LocalDateTime with system default time zone.
      Parameters:
      isoDateTime - raw ISO date time
      zoneId - zoneId to transform
      Returns:
      local date time