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

Add Configurable Timezone Option for Commit Date Processing #91

Open
2 tasks done
willdavidson05 opened this issue Aug 9, 2024 · 0 comments
Open
2 tasks done
Labels
enhancement New feature or request

Comments

@willdavidson05
Copy link
Member

Existing issue check

  • I found no existing issues covering this topic.

Description

Create a configuration option to allow users to specify their preferred timezone for commit date processing. The default will be UTC, ensuring consistency and avoiding timezone-related issues, but users can adjust it to suit their needs.

Example

Referencing these comments

Consider finding a way to infer the timezone from the source data to avoid errors associated with timezone assumptions (UTC vs non-UTC calculations may not result in the same outcomes).

Originally posted by @d33bs in #86 (comment)

It's unfortunately not obvious from pygit2's documentation, but the commit_time field is a UNIX timestamp, which doesn't really have a timezone because it's the seconds since January 1st, 1970 UTC. The tz argument to datetime.fromtimestamp() is not the timezone of the source, but the timezone of the returned datetime object. (FWIW, this makes the result a 'timezone-aware' datetime object; you should be very careful to correctly interpret datetime objects that don't have a timezone, since as @d33bs mentioned this can lead to hard-to-debug issues.) In this case, I think it makes sense to use UTC as long it's being used consistently in the codebase.

You might consider pulling it out as a configuration option so the user can choose their own timezone, but default to UTC if it's unspecified.

Originally posted by @falquaddoomi in #86 (comment)

Would you like to work on a solution for this?

  • Yes I am willing to submit a PR!
@d33bs d33bs added the enhancement New feature or request label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants