-
Notifications
You must be signed in to change notification settings - Fork 46
Allow parsing timestring at different timezones. #58
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,20 @@ | |
| (new (timestamp+ old 24 :hour eastern-tz))) | ||
| (is (= (* 24 60 60) (timestamp-difference new old))))) | ||
|
|
||
| (deftest test/timezone/parse-timestring-different-timezones () | ||
| (let ((*default-timezone* eastern-tz)) | ||
| (is (timestamp= | ||
| (parse-timestring "2016-12-01" :offset nil) ;; Use default timezone | ||
| (parse-timestring "2016-12-01" :offset (* 60 60 -5)) ;; Ignore timezone | ||
| (parse-timestring "2016-12-01" :offset (* 60 60 -5) :timezone utc-leaps) ;; Ignore timezone | ||
| (parse-timestring "2016-12-01" :offset nil :timezone eastern-tz) ;; Use timezone | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be wrapped in a (let ((default-timezone +utc-zone+)) ...) because you're not actually testing here that the timezone used is different from the default.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this were in UTC zone,
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, I've let this PR seriously languish. Sorry. I mean that by setting default-timezone to eastern-tz and carefully arranging the arguments so that they return the same timestamps, this test basically doesn't show that the arguments do anything at all. A version of parse-timestring that ignored all its arguments and only used default-timezone would pass this test. |
||
| (adjust-timestamp (parse-timestring "2016-12-01" :offset nil :timezone utc-leaps) (offset :hour +5)) ;; Use different timezone | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line seems more of a test of adjust-timestamp. |
||
| ;; Rest use timezone from timestring | ||
| (parse-timestring "2016-12-01T00:00:00-05:00") | ||
| (parse-timestring "2016-12-01T00:00:00-05:00" :offset 0) | ||
| (parse-timestring "2016-12-01T00:00:00-05:00" :offset -10) | ||
| (parse-timestring "2016-12-01T00:00:00-05:00" :offset nil :timezone utc-leaps))))) | ||
|
|
||
| (deftest test/timezone/timestamp-minimize-part () | ||
| (is (timestamp= | ||
| (timestamp-minimize-part | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're testing timezones but only using date timestamps? That seems odd.