Skip to content

Consider moving to isodate.parse_datetime as date time string unmarsaller #235

Closed
@playpauseandstop

Description

@playpauseandstop

I've run into issue when default format_datetime unmarshaller strips date time TZ as their code,

    timestamp = strict_rfc3339.rfc3339_to_timestamp(value)
    return datetime.datetime.utcfromtimestamp(timestamp)

convert datetime string to timestamp and create new datetime.datetime instance without tzinfo.

This means, for schema,

  value:
    type: "string"
    format: "date-time"

request or parameter data,

{"value": "2020-04-01T12:00:00+02:00"}

will result in value of datetime.datetime(2020, 4, 1, 10, 0, 0, tzinfo=None) (tz naive datetime value) instead of tz aware datetime value.

I've managed to fix it by supplying isodate.parse_datetime as unmarshaller for date-time strings in playpauseandstop/rororo#39 and would like to ask you consider change current format_datetime unmarshaller to parse_datetime function instead.

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