Skip to content

I propose format_datetime should use the time_zone parameter #7

@autarch

Description

@autarch

Migrated from rt.cpan.org #113568 (status was 'open')

Requestors:

From altreus@cpan.org on 2016-04-04 16:42:58:

I don't really think it makes sense for format_datetime to pass through to strftime on the DT object, because this completely ignores the fact the formatter has a time zone on it.

To my mind, the whole point of the formatter having a time zone is that it will convert $timezone <-> UTC.

Now, the output of parse_datetime is actually a DateTime object that knows it is $timezone, but that seems to me to be functionally equivalent to a UTC object - it's normalised data with sufficient metadata to be converted to any unit.

It seems sensible that if the formatter has a time zone specified, the user would want any strings formatted with it to be output based on that time zone. I would argue that is the whole point in the formatter: a container for the metadata required to convert the normalised DateTime object into a representation for output.

Currently, it seems to violate POLA.

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