Skip to content

Commit

Permalink
fix: wrong offset
Browse files Browse the repository at this point in the history
  • Loading branch information
enghitalo committed Oct 19, 2024
1 parent cf15c87 commit 5767e4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion vlib/time/parse.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub fn parse_rfc3339(s string) !Time {

offset_in_minutes += offset_in_hours * 60

if is_negative {
if !is_negative {
offset_in_minutes *= -1
}

Expand Down
12 changes: 6 additions & 6 deletions vlib/time/parse_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ fn test_parse_rfc3339() {
['2015-01-06T15:47:32Z', '2015-01-06 15:47:32.000000'],
['2015-01-06T15:47:32+00:00', '2015-01-06 15:47:32.000000'],
['2015-01-06T15:47:32-00:00', '2015-01-06 15:47:32.000000'],
['2015-01-06T15:47:32+01:00', '2015-01-06 16:47:32.000000'],
['2015-01-06T15:47:32-01:00', '2015-01-06 14:47:32.000000'],
['2015-01-06T15:47:32+01:10', '2015-01-06 16:57:32.000000'],
['2015-01-06T15:47:32-01:10', '2015-01-06 14:37:32.000000'],
['2015-01-06T15:47:32-01:00', '2015-01-06 16:47:32.000000'],
['2015-01-06T15:47:32+01:00', '2015-01-06 14:47:32.000000'],
['2015-01-06T15:47:32-01:10', '2015-01-06 16:57:32.000000'],
['2015-01-06T15:47:32+01:10', '2015-01-06 14:37:32.000000'],
['2015-01-06T15:47:32.1234-00:00', '2015-01-06 15:47:32.123400'],
['2015-01-06T15:47:32.1234-01:00', '2015-01-06 14:47:32.123400'],
['2015-01-06T15:47:32.1234+01:00', '2015-01-06 16:47:32.123400'],
['2015-01-06T15:47:32.1234+01:00', '2015-01-06 14:47:32.123400'],
['2015-01-06T15:47:32.1234-01:00', '2015-01-06 16:47:32.123400'],
]
for pair in pairs {
input, expected := pair[0], pair[1]
Expand Down

0 comments on commit 5767e4a

Please sign in to comment.