first and second in the YYYY-MM-DD format. Return the number of days between them. The dates may come in either order; the answer is never negative.
Mind the leap years: a year is a leap year if it is divisible by 4, except years divisible by 100 but not by 400.first="2024-02-27", second="2024-03-02" → 4
2024 is a leap year, so February has 29 days: from Feb 27 to Mar 2 is four days.
first="2031-01-10", second="2030-12-25" → 16
The order of the dates does not matter: from Dec 25 to Jan 10 is 16 days.
first="1999-07-04", second="1999-07-04" → 0
first="2024-02-27", second="2024-03-02"
4
Run checks the first 3 tests in your browser. Submit checks all 141 tests on the server, hidden ones included.