view roundup/anypy/datetime_.py @ 7674:b8aef93178db

fix: quote variable substitution To prevent issues with spaces in the variable. The var should be a single word but it pays to be careful. Courtesy of https://www.shellcheck.net/
author John Rouillard <rouilj@ieee.org>
date Tue, 24 Oct 2023 21:45:05 -0400
parents 6894f152d49a
children d5d7ecd31864
line wrap: on
line source

# https://issues.roundup-tracker.org/issue2551278
# datetime.utcnow deprecated
try:
    from datetime import datetime, UTC

    def utcnow():
        return datetime.now(UTC)

except ImportError:
    from datetime import datetime

    def utcnow():
        return datetime.utcnow()

Roundup Issue Tracker: http://roundup-tracker.org/