Your question is Date Difference From Scratch. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Apple Health may contain events recorded on different calendar dates. Given two valid dates in the proleptic Gregorian calendar, calculate the exact absolute difference in days without using standard library date parsers or date classes.
Implement days_between(date1, date2). Each date is a string in YYYY-MM-DD format. Parse the components manually, account for leap years, and return the non-negative number of days between the dates. A Gregorian leap year is divisible by 4, except century years must also be divisible by 400.
date1 and date2, each formatted as YYYY-MM-DD.datetime, date parsers, timestamps, or external libraries.def days_between(date1, date2):