← 返回 amazon 的题目列表Days Until Today Calculator
类型:online_judge
Given a date in string format, like "2023-10-01", compute the number of days from that date to today, with consideration for leap years. Do not use any built-in date functions. Implement a function calculate_days(date: str) -> int.
Example:
Input: '2023-10-01'
Output: 0
Constraints:
Date format is "YYYY-MM-DD".
The input date is within a reasonable range, e.g., from 2000 to the current year.
Output should be an integer.
Example
Input
date_str = '2023-10-01'