ManageSieve: make sieve_formattime() parse all time-formatters PHP does. #9655
+45
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 viarcmail.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 usingsieve_formattime()
, the OOO form, will generate times like "6:00 T" and so onThis causes the actual time be set to "Tango Time", i.e. UTC-7
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 viaset_env()
as in JS these values are extraordinarily hard to reliably to obtain without additional libraries.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 thath
would have been in theg
andh
cases. But I'm also happy reverting these changes if they are undesired.