Class DateTimeFormatUtils
java.lang.Object
org.vaadin.addons.componentfactory.schedulexcalendar.util.DateTimeFormatUtils
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeFormatterFormats dates as yyyyMMdd, e.g., 20250512static final DateTimeFormatterFormats times as HHmmss, e.g., 153045static final DateTimeFormatterFormats dates as yyyy-MM-dd, e.g., 2025-05-12.static final DateTimeFormatterFormats date and time as yyyy-MM-dd HH:mm, e.g., 2025-05-12 14:30.static final DateTimeFormatterFormats time as HH:mm, e.g., 14:30. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatZonedDateTime(String date) Parses an input date string that is expected to be inDateTimeFormatter.ISO_ZONED_DATE_TIMEformat (which represents a Temporal.ZonedDateTime) into aZonedDateTimeobject, and then formats it into a target String defined byDATE_TIME_FORMATTER.static LocalDateTimeParses a date string into aLocalDateTime, accepting two formats:YYYY-MM-DD HH:mm– parsed as-isYYYY-MM-DD– parsed as start of day (00:00), or end of day (23:59:59) ifendistrue
-
Field Details
-
DATE_FORMATTER
Formats dates as yyyy-MM-dd, e.g., 2025-05-12. -
DATE_TIME_FORMATTER
Formats date and time as yyyy-MM-dd HH:mm, e.g., 2025-05-12 14:30. -
TIME_FORMATTER
Formats time as HH:mm, e.g., 14:30. -
COMPACT_DATE_FORMATTER
Formats dates as yyyyMMdd, e.g., 20250512 -
COMPACT_TIME_FORMATTER
Formats times as HHmmss, e.g., 153045
-
-
Constructor Details
-
DateTimeFormatUtils
public DateTimeFormatUtils()
-
-
Method Details
-
parseDate
Parses a date string into aLocalDateTime, accepting two formats:YYYY-MM-DD HH:mm– parsed as-isYYYY-MM-DD– parsed as start of day (00:00), or end of day (23:59:59) ifendistrue
- Parameters:
date- the date string to parseend- whether to treat a date-only value as the end of the day- Returns:
- the parsed
LocalDateTime
-
formatZonedDateTime
Parses an input date string that is expected to be inDateTimeFormatter.ISO_ZONED_DATE_TIMEformat (which represents a Temporal.ZonedDateTime) into aZonedDateTimeobject, and then formats it into a target String defined byDATE_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.
-