A global application uses `date.today()` to generate invoice dates. Why might this cause consistency issues?
Python interview question for Advanced practice.
Answer
It relies on the server's system clock. 'Today' changes at different moments globally, leading to off-by-one errors.
Explanation
date.today() uses the local system time. In a distributed system or global app, relying on the server's local 'today' means users in different timezones might see incorrect dates (e.g., getting an invoice dated 'tomorrow'). Use datetime.now(timezone.utc).date() for consistency.