vaidyarm
4 years agoContributor
How to divide dates in to custom quarters
I have a special quarter division requirement where I have to allot data to different quarters based on the dates they belong, for this I need to get the first Monday of each month, tried the below logic to get it but not working for the Monday part.
Date.parse(‘2022-02-03’).getDay() == 1 ? Date.parse(‘2022-02-03’) : Date.parse(‘2022-02-03’).withDayOfWeek(1)