parse-crontab icon indicating copy to clipboard operation
parse-crontab copied to clipboard

Warning message for default_utc is incorrect

Open alexkiro opened this issue 2 years ago • 0 comments
trafficstars

It seems that this warning message may not be accurate anymore and can be a bit misleading?

FutureWarning: Version 0.22.0+ of crontab will use datetime.utcnow() and
datetime.utcfromtimestamp() instead of datetime.now() and
datetime.fromtimestamp() as was previous. This had been a bug, which will be
remedied. If you would like to keep the *old* behavior:
`ct.next(..., default_utc=False)` . If you want to use the new behavior *now*:
`ct.next(..., default_utc=True)`. If you pass a datetime object with a tzinfo
attribute that is not None, timezones will *just work* to the best of their
ability. There are tests...

The warning suggest that for version >= 0.22 the default_utc parameter will default to True if not specified. However that does not appear to be the case in version 1.0.1, and if I understand correctly the default is still the "old" behavior?


I'm unsure what the best solution would be here to resolve this:

  • Update the code to set default_utc to True if not specified and remove the warning.
  • Update the message to change to reflect that it will be changed in a future version (e.g. 1.1?)
  • Something else entirely?

alexkiro avatar Apr 11 '23 06:04 alexkiro