-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature/timezone support #15
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 75
💛 - Coveralls |
So if the rule is Now, I'm not sure what to do with Let say we are working with In reverse example we would change clock from 1:59am to 3:00am, so there is no 2am at all. Should 3am be set instead? |
I submitted #16 with broken tests for both of these cases. The expected behavior is outlined by RFC5545:
|
Feature/timezone support test cases
@pbogut I just want to make sure you saw the following note from #16 about one of those broken tests needing some changes:
|
@bgentry yes, I've read the comment, thank you for that. I will take it into account and make sure tests are checking correct timezone as well. |
So, I think we can go off this: When using Timex, Here's an example of what I'm thinking about: dt = {{2017, 11, 4}, {1, 30, 0}}
tz = "America/New_York"
case Timex.to_datetime(dt, tz) do
%DateTime{} = datetime ->
datetime
%Timex.AmbiguousDateTime{before: before, after: _after} ->
# ambiguous, use the first occurrence per the spec
before
{:error, {:could_not_resolve_timezone, ^tz, _gregorian_seconds, :wall}} ->
# non-existent time, add 1 hour
{date, {h, m, s}} = dt
Timex.to_datetime({date, {h + 1, m, s}}, tz)
end Now the last case with the |
@voughtdq that's very helpful. I did implementation for dates but couldn't figure out good way to do time. I think your idea should work all right. Will test it and see how its doing. Thanks. |
@pbogut have you been able to make some progress on this ? |
I didn't spent too much time on this I'm afraid, I started it but its still in progress. |
Attempt to resolve #14
The idea is to make
Timex
optional dependency and if available use different date helper to manipulate dates with timezone awareness.At this point it should respect timezone for dates.
Todo: