我想从计算两个日期之间的完整天数中排除 2 月 29 日。不包括区间的角值。
测试场景:
1 March 2012 - 28th February 2012 = should give 0 days.
1 March 2012 - 26th February 2012 = should give 2 days.
1 March 2013 - 28th February 2012 = should give 365 days and not 366 days.
1 March 2017 - 28th February 2012 = should give 365*5 =1825 days and not 1827 days.
目前我解析年份并检查日期之间是否有闰年,然后检查间隔是否为 2 月 29 日。有没有办法计算任何特定的时间间隔是否有特定的日期和发生次数,如果时间间隔跨越多年。