-
-
Notifications
You must be signed in to change notification settings - Fork 391
Timezone Support #7887
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
base: dev/feature
Are you sure you want to change the base?
Timezone Support #7887
Conversation
if (usingTimezone) { | ||
String timezone = this.timezone.getSingle(event); | ||
if (timezone == null) { | ||
return new Date[0]; |
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.
Should probably throw a runtime error here
try { | ||
targetZoneId = ZoneId.of(timezone); | ||
} catch (DateTimeException e) { // invalid zone format | ||
return new Date[0]; |
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.
runtime error
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 don't know about throwing an error here, there is no way to check if the timezone is valid
So the user can't sanitize it even if they wanted to
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.
Could add a condition to check if the timezone is a valid one
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 a lookup on 603 time zones worth it?
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.
if the user wants to yes
Problem
There isn't a way to get the date in a timezone without knowing its time offset.
Solution
Adds a new pattern to the
now
expression that lets you get the current clock time in the specified timezone. It won't be equal tonow
as it returns the shifted time (which will be mentioned in the syntax descriptions later).Also adds a new expression for getting a list of valid time zones.
Syntaxes:
now [timezone:in time[ ]zone %-string%]
all time[ ]zones
Testing Completed
Only manual testing was done. Proper tests will be written after syntax/functionality reviews.
Supporting Information
Completes: none
Related: none