Closed as not planned
Description
TemporalAdjusters
are a useful family of classes in the java.time
library
They allow to change a specific field value of a datetime according to a specific pattern commonly used by humans, avoiding the complications of the computation of such a value.
Common use cases (basically th list of adjusters from java.time):
- Getting a date, but with the day of month set to the first one
- Getting a date with day of month set to a last one in the current month
- In the same fashion, first day of next month
- First day of next / previous year / week
- returning a date, with the day set to a specific number of a given day of week. For example "second tuesday of March"
- Getting a date with the next given day of week (whatever date that day of week would result in) E.g., next monday will result in a wrap of the day of week if you call this on "tuesday" date, adding total 6 days to the date.
- Getting a date with previous day of week of a given value
My personal use case is this:
I want to set an alarm that fires on given days of week each week, and each time an alarm is fired, I schedule an alarm for the next day of week that alarm is enabled on. I want to get the next date for my specific day of week to trigger the next alarm.
I propose implementing these as extension functions on LocalDate
/ LocalDateTime
Metadata
Metadata
Assignees
Labels
No labels