Importing TemporalAdjusters is not allowed?

I'm trying to write an app that needs to do some date arithmetic. However, I'm running into this warning:

Importing [java.time.temporal.TemporalAdjusters] is not allowed

I found @gopher.ny's post listing the allowed imports, and indeed, it's not there. Is there a reason those functions are prohibited or is this more a matter of "don't open unless someone needs them"?

The function I'm trying to access is dayOfWeekInMonth(), so that I can handle holidays which occur e.g. the fourth Thursday of November. It's possible to grab an instance of the first of the month, skip forward to the desired day of the week, then skip forward the necessary number of weeks, but there's a perfectly good function to do that for me in Java/Groovy, so....

That. I don't see a reason not to open it, though.
We have DateUtils on the list in case that has something useful.

2 Likes

A cursory look at DateUtils shows some other good helper functions for Calendar/Date, but not a whole lot that helps with skipping around days of the week. (Also, IIUC, Calendar and Date are older and LocalDate is the thing to use these days? Though I'm not deeply enough into Java to know whether that matters all that much.)

At any rate, if you could add it to the whitelist, I'd appreciate it. Saves me some code.

Check out 2.3.2.128, fresh out of the oven.
The post timing was just right...

1 Like