[Feature Request]: Timezone handling for the datetime picker and datetime field widget
Checklist
- [x] I am using an up-to-date version.
- [x] I have read the documentation.
- [x] I have searched existing issues.
Description
Currently, the datetime picker and datetime field widget use exclusively UTC, which means any datetimes input won't be the correct timestamp (unless the user is in UTC), and if inputting the correct timestamp directly into the database, the displayed time won't be correct for the user's local timezone.
Solution
I'd suggest two changes:
- A timezone setting in the library's settings, giving a dropdown containing common timezones (such as UTC-5:00, UTC+9:00, etc), which will be used in the datetime field widget.
- It may be a good idea to also allow the user to enter their own timezone offset, as some places have really odd timezone offsets.
- A timezone dropdown next to the datetime picker, which will be used for interpreting the datetime input.
- There are some niche cases where you may want to input a datetime from a timezone other than your own. By default, though, it should be prefilled with your library's timezone.
Ensuring timestamps are displayed correctly would make it easier for users to have macros which automatically populate datetime fields in the future. In my case, I eventually want to have a macro which will go through entries with a Discord message ID field and populate their Date Created field with the timestamp of that message, since Discord message IDs can be converted directly into the message's timestamp.
- This could be extended to other platforms as well, where it takes a source URL or ID, makes an API call to get the timestamp of the post, and populates a datetime field.
Alternatives
You can choose between:
- Entering the time as seen from your timezone, resulting in the datetime field widget displaying the correct time for your timezone, but having the timestamp stored internally being wrong.
- Entering the correct timestamp directly into the database, but having the datetime field widget displaying the incorrect time for your timezone.
The current text based date time picker is planned to be changed to one based on QDateTimeEdit which should take care of this issue