java.lang.Object
org.vaadin.addons.componentfactory.schedulexcalendar.util.DateTimeFormatUtils

public final class DateTimeFormatUtils extends Object
Utility class that provides shared DateTimeFormatter instances for consistent date and time formatting across the ScheduleX implementation.

This class is not intended to be instantiated.

  • Field Details

    • DATE_FORMATTER

      public static final DateTimeFormatter DATE_FORMATTER
      Formats dates as yyyy-MM-dd, e.g., 2025-05-12.
    • DATE_TIME_FORMATTER

      public static final DateTimeFormatter DATE_TIME_FORMATTER
      Formats date and time as yyyy-MM-dd HH:mm, e.g., 2025-05-12 14:30.
    • TIME_FORMATTER

      public static final DateTimeFormatter TIME_FORMATTER
      Formats time as HH:mm, e.g., 14:30.
    • COMPACT_DATE_FORMATTER

      public static final DateTimeFormatter COMPACT_DATE_FORMATTER
      Formats dates as yyyyMMdd, e.g., 20250512
    • COMPACT_TIME_FORMATTER

      public static final DateTimeFormatter COMPACT_TIME_FORMATTER
      Formats times as HHmmss, e.g., 153045
  • Constructor Details

    • DateTimeFormatUtils

      public DateTimeFormatUtils()
  • Method Details

    • parseDate

      public static LocalDateTime parseDate(String date, boolean end)
      Parses a date string into a LocalDateTime, accepting two formats:
      • YYYY-MM-DD HH:mm – parsed as-is
      • YYYY-MM-DD – parsed as start of day (00:00), or end of day (23:59:59) if end is true
      Parameters:
      date - the date string to parse
      end - whether to treat a date-only value as the end of the day
      Returns:
      the parsed LocalDateTime
    • formatZonedDateTime

      public static String formatZonedDateTime(String date)
      Parses an input date string that is expected to be in DateTimeFormatter.ISO_ZONED_DATE_TIME format (which represents a Temporal.ZonedDateTime) into a ZonedDateTime object, and then formats it into a target String defined by DATE_TIME_FORMATTER. Used in methods handling events data received from the underlying component.
      Parameters:
      date - The date string to parse, expected in ISO-8601 zoned date-time format.
      Returns:
      The formatted date-time string.