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

Force use UTC as local timezone with feature flag #36

Open
ralpha opened this issue Oct 15, 2021 · 2 comments
Open

Force use UTC as local timezone with feature flag #36

ralpha opened this issue Oct 15, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@ralpha
Copy link
Collaborator

ralpha commented Oct 15, 2021

Some parts of the spec specify that local time should be used as default in some cases.
The system timezone of the machine will be used in those cases (or should be used).
With a feature flag this should default to UTC regardless where the system is currently located/configured.

This feature is useful when the crate is used on servers.

Alternatively an environment variable can be used to specify the desired fixed timezone.

@ralpha ralpha added the enhancement New feature or request label Oct 15, 2021
@ralpha ralpha changed the title Use UTC timezone with feature flag Force use UTC as local timezone with feature flag Oct 15, 2021
@omid
Copy link
Collaborator

omid commented May 23, 2022

I suggest having a method, inside RRuleSet, instead of having a feature flag.
Again, Cargo requires that features are additive and it may affect other libraries unexpectedly.

@fmeringdal
Copy link
Owner

Another option which I am thinking about is making RRuleSet generic over the timezone used. Then the server code will look something like this:

use chrono::Utc;

let rrule_set: RRuleSet<Utc> = "DTSTART:...".parse().unwrap();

// Below will yield occurrences in Utc timezone
rrule_set.all(100); 

This approach will also solve #49 where generated occurrences should be in Local timezone and not chrono_tz::Tz.

use chrono::Local;

let rrule_set: RRuleSet<Local> = "DTSTART:...".parse().unwrap();

// Below will yield occurrences in Local timezone
rrule_set.all(100); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants