java.lang.Object
io.github.palexdev.materialfx.utils.DateTimeUtils
Utils class for Java's time API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple bean to wrap info about a day of a month such as: -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic YearMonthdateToYearMonth(LocalDate date) static intendIndexFor(YearMonth yearMonth, Locale locale) Computes the index at which the month ends, by computing the starting index,startIndexFor(YearMonth, Locale), and then adding the length of the month to the result - 1.static DateTimeUtils.Day[][]fullDayMonthMatrix(Locale locale, YearMonth yearMonth) Builds a bi-dimensional array ofDateTimeUtils.Days (6 rows x 7 columns) that completely fills the matrix.static Integer[][]fullIntMonthMatrix(Locale locale, YearMonth yearMonth) Builds a bi-dimensional array of integers (6 rows x 7 columns) that completely fills the matrix.static DateTimeUtils.Day[][]partialDayMonthMatrix(Locale locale, YearMonth yearMonth) Builds a bi-dimensional array ofDateTimeUtils.Days (6 rows x 7 columns) that contains only the days of the month specified by the givenYearMonth.static Integer[][]partialIntMonthMatrix(Locale locale, YearMonth yearMonth) Builds a bi-dimensional array of integers (6 rows x 7 columns) that contains only the days of the month specified by the givenYearMonth.static intstartIndexFor(YearMonth yearMonth, Locale locale) Builds a map containing the week days according to the given locale, seeweekDays(Locale)for further info.TheDayOfWeekenumerator assumes that Monday is the first day of the week.
-
Field Details
-
CALENDAR_ROWS
public static final int CALENDAR_ROWS- See Also:
-
CALENDAR_COLUMNS
public static final int CALENDAR_COLUMNS- See Also:
-
-
Method Details
-
partialIntMonthMatrix
Builds a bi-dimensional array of integers (6 rows x 7 columns) that contains only the days of the month specified by the givenYearMonth. That means that at most 31 positions will contain a day, the others will contain null. -
partialDayMonthMatrix
Builds a bi-dimensional array ofDateTimeUtils.Days (6 rows x 7 columns) that contains only the days of the month specified by the givenYearMonth. That means that at most 31 positions will contain a day, the others will contain null. -
fullIntMonthMatrix
Builds a bi-dimensional array of integers (6 rows x 7 columns) that completely fills the matrix. Empty positions will contain the days belonging the the previous/next month. -
fullDayMonthMatrix
Builds a bi-dimensional array ofDateTimeUtils.Days (6 rows x 7 columns) that completely fills the matrix. Empty positions will contain the days belonging the the previous/next month. -
startIndexFor
Builds a map containing the week days according to the given locale, seeweekDays(Locale)for further info. Then gets the startingDayOfWeekfor the given month, and queries the map with it.The result is the index at which the month starts.
-
endIndexFor
Computes the index at which the month ends, by computing the starting index,startIndexFor(YearMonth, Locale), and then adding the length of the month to the result - 1. -
weekDays
TheDayOfWeekenumerator assumes that Monday is the first day of the week. This however depends on the country (locale).This method generates a Map associating each
DayOfWeekto its position in the week.So, for example for the US locale, Sunday which is the seventh
DayOfWeekis associated to 1, since the week starts with Sunday. -
dateToYearMonth
-