Skip to content
Advertisement

Monday 2 weeks from sunday last week. How?

I run into a bit of a challenge trying to figure out how to capture the range of 2 week payrolls.

How would I go about modifying the -2W case?

JavaScript

Advertisement

Answer

You should really look at DateTime probably DatePeriod. But to answer the question with existing code I think you will need two formats, one if today is a Monday and another if it’s not:

JavaScript

Someone may be able to find one format that works for both.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement