-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: Add flag to set the timezone on reports #253
feat: Add flag to set the timezone on reports #253
Conversation
c12ae79
to
f422439
Compare
By default all the dates are in UTC, this commit adds a new flag: '--time-zone' or '-z' that allows the user to pass a timezone. This is a breaking change, now, by default the used timezone is 'local', meaning the value returned by 'time.local'. Examples: - Madrid Timezone: -z Europe/Madrid - Current timezone: -z local A full list of timezones can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones This can fix some issues reported in lucassabreu#135. Signed-off-by: Arturo Volpe <[email protected]>
f422439
to
7446538
Compare
@@ -246,6 +246,7 @@ func TestReportWithRange(t *testing.T) { | |||
}, | |||
flags: func(t *testing.T) util.ReportFlags { | |||
rf := util.NewReportFlags() | |||
rf.TimeZone = "UTC" |
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.
add another entry in the table, but with the following format:
rf.Format = "{{.ID}};{{ .TimeInterval.Start.Format " +
`"2006-01-02 15:04:05"` +
" }}"
and a offset timezone so we can see the effect here.
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.
@lucassabreu thanks for the comments, I have some strange bugs with this feature (the date-filling flag), I will try to fix them this week.
Co-authored-by: Lucas dos Santos Abreu <[email protected]>
By default all the dates are in UTC, this commit adds a new flag: '--time-zone'
or '-z' that allows the user to pass a timezone.
This is a breaking change, now, by default the used timezone is 'local', meaning
the value returned by 'time.local'.
Examples:
A full list of timezones can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
This can fix some issues reported in #135.
I'm open to fix this PR with your suggestions.
(note that using the time.local timezone is the currently the only option in some report outputs)