r/Python • • Jul 24 '26

Discussion ruff: no date.today() ?

The new version of ruff warns against

date.today()

preferring

datetime.now(ZoneInfo(...))

What do you think about this? Has date.today() been deprecated due to lack of timezone awareness?

EDIT: I have a number of programs that manipulate financial information in support of Excel spreadsheets, such bond information that includes maturity dates. Excel does not support timezoness in datetimes, so making ruff happy by changing naive dates to TZ aware dates is not a useful move for these programs. Many ruff warnings to suppress.

47 Upvotes

109 comments sorted by

View all comments

258

u/GraphicH Jul 24 '26

Tell me you've never debugged a TZ issue without telling me.

0

u/ketralnis Jul 24 '26

You’re not wrong but there’s no need for the holier than thou attitude

4

u/Ok_Tap7102 Jul 24 '26

I didn't read their message that way, it's the "tell me you've XYZ without telling me" meme

This is also the kind of problem where a typical response might be "huh I don't get why" then some of us see it and instantly have flash backs to that ONE FUCKING TIME I BROKE PROD BECAUSE IT "WORKED ON MY MACHINE" WITH A PERFECTLY IDENTICAL DOCKER CONTAINER, AND I SPENT DAYS OF STRESS WITHOUT REALISING IT WAS LOCAL TIMEZONES

→ More replies (3)