Skip to content

Date and Datetime should handle unix timestamps #33

Description

@todofixthis

If Date or Datetime detects that the incoming value is an int or float, it should interpret the value as a unix timestamp.

Note that this does not apply if the incoming value is a string, even if it looks like a unix timestamp.

Examples:

>>> f.Datetime().apply(1508882922)
datetime.datetime(2017, 10, 25, 11, 8, 42, tzinfo=<UTC>)

>>> f.Datetime().apply(1508882922.333)
datetime.datetime(2017, 10, 25, 11, 8, 42, 333000, tzinfo=<UTC>)

>>> f.Date().apply(1508882922)
datetime.date(2017, 10, 25)

>>> f.Datetime().apply('1508882922')
FilterError: This value does not appear to be a datetime.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions