How to judge whether there is a number 31 in a certain time interval

as shown in the figure, how to easily and quickly determine whether there is a 31 in a given time interval

Aug.12,2021

hypothesis rationality check has passed start < end

start.year < end.year | | start.month + 2 < = end.month | | (start.month = = end.month & & end.day = = 31) | |
[1, 3, 5, 7, 8, 10, 12] .indexOf (start.month)! =-1

first judge that there must be 31 for the New year, 31 for the difference of two months in the same year, 31 for the end day of the same month, 31 for the beginning of January in the same year, 31 for the starting month of January in the same year


http://momentjs.cn/docs/-sharp/dis.
uses ready-made wheels for convenience and safety, and the speed is definitely not as fast as the original

.
Menu