Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unix timestamp support to Date and Datetime filters #39

Closed
todofixthis opened this issue Mar 12, 2018 · 1 comment
Closed

Add unix timestamp support to Date and Datetime filters #39

todofixthis opened this issue Mar 12, 2018 · 1 comment

Comments

@todofixthis
Copy link
Contributor

Date and Datetime should be able to interpret incoming unix timestamps.

Notes:

  • Unix timestamps could be ints, floats or strings.
  • Unix timestamps are always UTC.

Examples:

value = datetime(2018, 3, 13, 12, 39, 50).timestamp()

>>> f.Date().apply(value)
datetime.date(2018, 3, 13)

>>> f.Datetime().apply(value)
datetime.datetime(2018, 3, 13, 12, 39, 50, tzinfo=<UTC>)

# Unix timestamps are always UTC.
>>> f.Datetime(timezone=12).apply(value)
datetime.datetime(2018, 3, 13, 12, 39, 50, tzinfo=<UTC>)
@todofixthis
Copy link
Contributor Author

Duplicate of #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant