Skip to content

Timezone MDT not supported for parsing (yet it works for formatting) #686

Open
@AdamLeMmon01

Description

@AdamLeMmon01

Steps to reproduce

format_str = "{YYYY}-{M}-{D} {h24}:{m}:{s} {Zabbr}"
{:ok, datetime} = DateTime.new(~D[2021-09-13], ~T[00:00:00.000], "America/Denver")
{:ok, d } = Timex.format(datetime, format_str) # this outputs MDT as the timezone, but it cannot parse the datetime back from that string.
IO.puts d # => "2021-9-13 00:00:00 MDT"
IO.inspect Timex.parse(d, format_str) # => {:error, :time_zone_not_found}

Description of issue

  • Using the same input string, the formatted output should be able to be re-parsed to a date time.
  • Clearly the library recognizes MDT as a valid date time because I do not have MDT anywhere in my code. It is correctly converting from America/Denver to MDT, but it cannot parse it back from MDT again.
  • In the above example, the output of d should match the input of datetime. I believe the format call will return MDT part of the year and MST part of the year, but the end result or parsing it again should still return the same DateTime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions