-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
src/main/java/ch/njol/skript/conditions/CondIsTimezoneValid.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/conditions/CondIsTimezoneValid.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/conditions/CondIsTimezoneValid.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/conditions/CondIsTimezoneValid.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/conditions/CondIsTimezoneValid.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
public class CondIsTimezoneValid extends Condition { | ||
|
||
static { | ||
Skript.registerCondition(CondIsTimezoneValid.class, "%strings% (are|is [a[n]]) [negate:in]valid time[ ]zone[s]"); |
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 be a property condition, and just do setNegated(isNegated() == hasTag("negate")
in init()
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.
Yeah, I think a BE
PropertyCondition would work. is a valid timezone
, is not a valid timezone
, is an invalid timezone
, etc.
src/main/java/ch/njol/skript/expressions/ExprDateInTimezone.java
Outdated
Show resolved
Hide resolved
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.
A couple minor things
public class ExprAllTimezones extends SimpleLiteral<String> { | ||
|
||
static { | ||
Skript.registerExpression(ExprAllTimezones.class, String.class, ExpressionType.SIMPLE, "all [of [the]] time[ ]zones"); |
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.
Skript.registerExpression(ExprAllTimezones.class, String.class, ExpressionType.SIMPLE, "all [of [the]] time[ ]zones"); | |
Skript.registerExpression(ExprAllTimezones.class, String.class, ExpressionType.SIMPLE, "[the|all [[of] the]] time[ ]zones"); |
the
, all the
, all of the
public class CondIsTimezoneValid extends Condition { | ||
|
||
static { | ||
Skript.registerCondition(CondIsTimezoneValid.class, "%strings% (are|is [a[n]]) [negate:in]valid time[ ]zone[s]"); |
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.
Yeah, I think a BE
PropertyCondition would work. is a valid timezone
, is not a valid timezone
, is an invalid timezone
, etc.
Problem
There isn't a way to get the date in a timezone without knowing its time offset.
Solution
Adds three new syntaxes for working with time zones.
Expressions:
[the] [date[s]] %dates% in time[ ]zone %string%
or[the] [date[s]] %dates% in [the] %string% time[ ]zone
all [of [the]] time[ ]zones
Conditions:
%strings% (are|is [a[n]]) [negate:in]valid time[ ]zone[s]
This PR also forces the test environment to use the
UTC
timezone.Testing Completed
Tests are available in timezones.sk
Supporting Information
Tests will stop failing when this is merged
Completes: none
Related: none