zone end projection was buggy, since it didn't normalize dates before passing them on (required for ezic_date:all_times/1)
This commit is contained in:
@@ -80,12 +80,14 @@ offset_sec(Zone) ->
|
||||
|
||||
|
||||
|
||||
% returns the UTC datetime projected for zone end (given current DST Offset)
|
||||
% returns ALL datetimes projected for zone end (given current DST Offset)
|
||||
project_end(#zone{until=Until, gmtoff=Offset}, DSTOffset) ->
|
||||
ezic_date:all_times(Until, Offset, DSTOffset).
|
||||
NUntil= ezic_date:normalize(Until),
|
||||
ezic_date:all_times(NUntil, Offset, DSTOffset).
|
||||
|
||||
% returns just the UTC datetime projected for zone end
|
||||
project_end_utc(Zone=#zone{}, DSTOffset) ->
|
||||
% ?debugVal(Zone),
|
||||
{_,_,UTCDatetime}= project_end(Zone, DSTOffset),
|
||||
UTCDatetime.
|
||||
|
||||
|
||||
@@ -31,6 +31,11 @@ project_end_utc_test_() ->
|
||||
ezic_zone:project_end_utc(
|
||||
#zone{until={{2010,11,10},#tztime{time={16,20,0}, flag=u}}, gmtoff={-7,0,0}}
|
||||
, {1,0,0}))
|
||||
|
||||
|
||||
%% previously failing for "Asia/Irkutsk"
|
||||
, ?_assertEqual({{1879,12,31},{17,2,40}}, ezic_zone:project_end_utc(
|
||||
#zone{until={1880,1,1}, gmtoff={6,57,20}}, {0,0,0}))
|
||||
].
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user