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

Timex 2.2.1: ** (Timex.Parse.ParseError) Expected end of input for parsing dates using :strftime for certain timezones #199

Closed
marcelog opened this issue Jul 21, 2016 · 2 comments

Comments

@marcelog
Copy link
Contributor

marcelog commented Jul 21, 2016

Hello,

I'm getting the following error with Timex 2.2.1:

Timex.parse! "2016-01-01T19:32:32 America/Port-au-Prince", "%Y-%m-%dT%H:%M:%S %Z", :strftime
** (Timex.Parse.ParseError) Expected end of input at line 1, column 32
    lib/parse/datetime/parser.ex:85: Timex.Parse.DateTime.Parser.parse!/3

As an example, the timezone America/Port-au-Prince exists as a valid Timezone when calling Timex.timezones/0.

The expected result would be to get a valid DateTime.

Perhaps I'm missing something?

Thanks in advance!

Update: this actually works:

> now = DateTime.now
> now_in_tz = Timezone.convert now, "America/Port-au-Prince"
#<DateTime(2016-07-20T19:06:35 America/Port-au-Prince (-05:00:00))>
> Timex.format(now_in_tz, "%Y-%m-%dT%H:%M:%S %Z", :strftime)
{:ok, "2016-07-20T19:06:35 America/Port-au-Prince"}
@bitwalker
Copy link
Owner

Fixed in 3.0.5. I can potentially backport this fix if required, let me know.

@marcelog
Copy link
Contributor Author

Thanks for the fix!

We've upgraded to 3.0.0 (and now 3.0.5) since then, so we don't need the backport (although perhaps other might benefit from it!)

Cheers!

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

2 participants