-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Allow users to display local time in profile #27748
base: main
Are you sure you want to change the base?
Conversation
Just a thought and question. Can't we do it in simple js. |
If we use JS, we can't return the current time with the API. We also can't be sure every users sees the same time. Maybe a timezone changes e.g daylight saving time. In this case, the users will eventually see different times on different devices, depending how up to date it is. Also some people want to use at least JS as possible. |
Include me that, I understood your solution. Give me today's time to review this change. Will share my findings. |
options/timezones.csv
Outdated
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.
For anyone wondering, this file hardcodes any timezone change from 1893 to 2499.
Hmm… How much extra strain is that on any instance?
I can't imagine it to be small, my current estimate is something like 7MB.
Is my calculation correct?
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.
Do we want that much "bloat"?
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.
Is that .gz
and still 7mb.
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.
Without gzip, the file is currently 6.05 MB, which gzip it's 844 KB. I will rewrite 5the Code to use a gziped file.
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.
IMO gzip is fine. I am okay with that.
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.
The CSV is now compressed
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.
Thanks @JakobDev I have reviewed the half Pr, Need todays'time more.
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.
I was able to reduce the size drastically. The CSV now only contains the info from 5 years ago until 30 years in the future. It also only includes the needed columns. We are now at 45KB.
Implements https://codeberg.org/forgejo/forgejo/issues/1089
This allows users to set their timezone in the profile settings, so their local time will be displayed on the profile.
Where does the data came from?
From this CSV
Why use the CSV instead of the built-in timezone support of Go?
Screenshoots:
![grafik](https://private-user-images.githubusercontent.com/15185051/277307121-2f1eef64-0d00-4c64-afd0-57a23d441a89.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzgxNzYsIm5iZiI6MTczOTk3Nzg3NiwicGF0aCI6Ii8xNTE4NTA1MS8yNzczMDcxMjEtMmYxZWVmNjQtMGQwMC00YzY0LWFmZDAtNTdhMjNkNDQxYTg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE1MTExNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzNzEwZDljMTBkNGNhZmVhZTA0OTEwMDVkNjk5Y2MwOWQ4NDAzYTJjNTAzZDMyMDFmZmVlNTQ2NzBiYjMzNDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3HGx5fOeDNNTyKaR1ng7kDWGKHykLgP0e3G5forAzHs)
![grafik](https://private-user-images.githubusercontent.com/15185051/277307234-acc185b7-03a4-4971-bd58-a0ecc73164da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzgxNzYsIm5iZiI6MTczOTk3Nzg3NiwicGF0aCI6Ii8xNTE4NTA1MS8yNzczMDcyMzQtYWNjMTg1YjctMDNhNC00OTcxLWJkNTgtYTBlY2M3MzE2NGRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE1MTExNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5MWYzZjdhZGViZmFmNTkyNWVhN2YxZGFkNzRiMGU5N2RmYjdiNjNhOWZhYTU5MzE0ZWU4YzYxOTEyMzZjMmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wYLE3iUxaXgUzoYrr-twpAdq3_CMXcUQlVD5c1Zmwug)
As usual, the migration will be added when everything reviewed