-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(date): use available timezone if any (#94)
## Description It's important to use the date timezone if it has any. ## Changes Do not switch back to Local timezone if not needed ## Fixes #81 ## Checklist - [X] I have read the **CONTRIBUTING.md** document. - [X] My code follows the code style of this project. - [X] I have added tests to cover my changes. - [X] All new and existing tests passed. - [ ] I have updated the documentation accordingly. - [ ] This change requires a change to the documentation on the website. ## Additional Information <!-- Any additional information regarding this pull request. --> Timezones are always fun --------- Signed-off-by: ccoVeille <[email protected]> Co-authored-by: Atomys <[email protected]>
- Loading branch information
Showing
13 changed files
with
402 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package pesticide | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
// ForceTimeLocal temporarily sets [time.Local] for test purpose. | ||
func ForceTimeLocal(t *testing.T, local *time.Location) { | ||
t.Helper() | ||
|
||
originalLocal := time.Local | ||
time.Local = local | ||
t.Cleanup(func() { time.Local = originalLocal }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.