How to extract a date from a java.time.LocalDate

I have a function which returns a pair of (java.time.LocalDate, Double). Can I pattern match that against a month from 1 to 12? If not, how can I extract the month number from a java.time.LocalDate?

Apparently the date was created with a call such as LocalDate.of(1979, 3, 23).

But I can’t pattern match against LocalDate.of(year, month,day).

You probably want to write an extractor that takes a LocalDate as its parameter…

I figured out that date.getMonth() returns the month. So I tried to test 12 == date.getMonth which compiles fine. But is always false because getMonth returns a string “DEC”. So, then I tried getMonthValue which seems to return the integer version of the month.