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

ManageSieve: make sieve_formattime() parse all time-formatters PHP does. #9655

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bennet0496
Copy link

@bennet0496 bennet0496 commented Sep 27, 2024

Roundcube's $config['time_format'] understands all PHP time and especially timezone format specifiers listed in the PHP docs; however, sieve_formattime() that used this value via rcmail.env.time_format does not.

Therefore if the config value e.g. is $config['time_format'] = "H:i T" to include the abbreviated timezone name (which works else where, like the message list), then forms using sieve_formattime(), the OOO form, will generate times like "6:00 T" and so on
image
This causes the actual time be set to "Tango Time", i.e. UTC-7
image
Which for users outside of UTC-7 is unexpected behavior.

Therefore I changed sieve_formattime() to understand any formatter that may reasonably (or unreasonably, like microseconds or Unix Time. But never say never) be configured by an admin or user. For the timezone values, I opted to pass these values from PHP to JS via set_env() as in JS these values are extraordinarily hard to reliably to obtain without additional libraries.
image

I also changed some thing at the beginning of sieve_formattime() that looked odd to me. Like per-declaring all variables. And actually used the value that h would have been in the g and h cases. But I'm also happy reverting these changes if they are undesired.

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.

1 participant