Some places(country) start the week with Sunday, some with Monday, maybe some with others, IDK, some this magic let java library find the right one for us. Calculate the day of the week at the beginning of the local week (Monday, Sunday, and more)
DayOfWeek firstDayOfWeek = WeekFields.of(locale).getFirstDayOfWeek();
LocalDate firstDay = today.with(TemporalAdjusters.previousOrSame(firstDayOfWeek));
*only serve as memo so actual syntax may break
Recommended Posts