Skip to content

Apply localTimeZone offset when reading DateAndTime instances #10

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions MySQL-Core-Tests-Integration/MySQLStatementReadTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -228,30 +228,18 @@ MySQLStatementReadTest >> testReadTimeTypes [

resp := stmt execute.
self assert: resp isResultSet.
self assert: resp rows size = 4.
self assert: resp rows size equals: 4.

self assert: (resp rows first atIndex: 2) = (Date fromString: '07-01-2011').
self assert: (resp rows first atIndex: 3) = (Time fromString: '18:35:23').
self assert: (resp rows first atIndex: 4) =
(DateAndTime
localTimeZone: TimeZone default;
fromString: '2011-07-02T10:12:45.000000000').
self assert: (resp rows first atIndex: 5) =
(DateAndTime
localTimeZone: TimeZone default;
fromString: '01-12-1980 00:45:56-00:00').
self assert: (resp rows first atIndex: 6) = 1999.
self assert: (resp rows first atIndex: 2) equals: (Date fromString: '07-01-2011').
self assert: (resp rows first atIndex: 3) equals: (Time fromString: '18:35:23').
self assert: (resp rows first atIndex: 4) equals: (DateAndTime fromString: '2011-07-02T10:12:45.000000000').
self assert: (resp rows first atIndex: 5) equals: (DateAndTime fromString: '01-12-1980 00:45:56').
self assert: (resp rows first atIndex: 6) equals: 1999.

self assert: (resp rows second atIndex: 2) = (Date fromString: '06-01-2011').
self assert: (resp rows second atIndex: 3) = (Duration fromString: '03:17:34:22').
self assert: (resp rows second atIndex: 4) =
(DateAndTime
localTimeZone: TimeZone default;
fromString: '2011-06-02T09:11:44.000000').
self assert: (resp rows second atIndex: 5) =
(DateAndTime
localTimeZone: TimeZone default;
fromString: '02-13-1980 01:44:55')]
self assert: (resp rows second atIndex: 2) equals: (Date fromString: '06-01-2011').
self assert: (resp rows second atIndex: 3) equals: (Duration fromString: '03:17:34:22').
self assert: (resp rows second atIndex: 4) equals: (DateAndTime fromString: '2011-06-02T09:11:44.000000').
self assert: (resp rows second atIndex: 5) equals: (DateAndTime fromString: '02-13-1980 01:44:55')]

]

Expand Down
2 changes: 1 addition & 1 deletion MySQL-Core/MySQLBinaryReader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ MySQLBinaryReader >> dateTimeFrom: aStream [ "ByteStream"
^ DateAndTime
year: year month: month day: day
hour: hh minute: mm second: ss
nanoSecond: ns offset: 0 hours
nanoSecond: ns offset: DateAndTime localTimeZone offset

]

Expand Down