Skip to content

[ADR] time #102

@utnapischtim

Description

@utnapischtim

replace datetime.utcnow()

datetime.now(timezone.utc).replace(tzinfo=None)
arrow.utcnow().datetime
today = arrow.utcnow().date().isoformat()
expires_at = arrow.get(expires_at).to("utc").datetime.replace(tzinfo=None)
reindex_start_time = datetime.utcnow().isoformat()
(datetime.utcnow() + timedelta(days=days)).date().isoformat()
return datetime.utcnow() > self.expires_at

only examples from invenio-rdm-records

PR's until now:

inveniosoftware/invenio-db#179
inveniosoftware/invenio-db#178
inveniosoftware/invenio-banners#42
inveniosoftware/flask-security-fork#78
inveniosoftware/flask-kvsession#11
inveniosoftware/invenio-files-rest#335

not yet opened PR's
flask-oauthlib-invenio
flask-iiif
invenio-rdm-records
invenio-jobs
invenio-stats
invenio-communities
invenio-drafts-resources
invenio-checks
invenio-requests
invenio-github
invenio-cache
invenio-oaiserver
invenio-oauth2server
invenio-formatter
invenio-audit-logs
invenio-records
invenio-users-resources
invenio-records-resources
invenio-oauthclient
invenio-accounts
invenio-previewer
pytest-invenio

NOTE: ILS not considered in this list!

Problems:

  • how to replace dateime.utcnow backwards compatible
  • replace arrow usage too

Solutions:

  • replace the usage completely with arrow.utcnow()
    • drawback: relying on a third party library, which seems not fully maintained, no release since 2 years and quite some unreleased commits on master with a few open PR's and issues
  • create a library for invenio to thandle the time every time the same
    • how to enforce it's usage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions