Skip to content
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

Merged

Conversation

aVolpe
Copy link
Contributor

@aVolpe aVolpe commented Jan 9, 2024

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 #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)

@aVolpe aVolpe force-pushed the feature/add_flag_to_set_time_entry_timezone branch from c12ae79 to f422439 Compare January 9, 2024 17:28
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]>
@aVolpe aVolpe force-pushed the feature/add_flag_to_set_time_entry_timezone branch from f422439 to 7446538 Compare January 9, 2024 17:29
@@ -246,6 +246,7 @@ func TestReportWithRange(t *testing.T) {
},
flags: func(t *testing.T) util.ReportFlags {
rf := util.NewReportFlags()
rf.TimeZone = "UTC"
Copy link
Owner

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.

Copy link
Contributor Author

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.

@lucassabreu lucassabreu merged commit 8d00e18 into lucassabreu:main Jun 14, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants