| 18 | }; |
| 19 | |
| 20 | const getMaxCalendarDate = (primaryCalendarType: `${CalendarType}`) => { |
| 21 | const key = `max ${primaryCalendarType}`; |
| 22 | |
| 23 | if (!cache.has(key)) { |
| 24 | const maxDate = new CalendarDate(1, 0, 1, primaryCalendarType); |
| 25 | maxDate.setYear(9999); |
| 26 | maxDate.setMonth(11); |
| 27 | const tempDate = new CalendarDate(maxDate, primaryCalendarType); |
| 28 | tempDate.setDate(1); |
| 29 | tempDate.setMonth(tempDate.getMonth() + 1, 0); |
| 30 | maxDate.setDate(tempDate.getDate());// 31st for Gregorian Calendar |
| 31 | cache.set(key, maxDate); |
| 32 | } |
| 33 | |
| 34 | return cache.get(key)!; |
| 35 | }; |
| 36 | |
| 37 | export { |
| 38 | getMinCalendarDate, |