https://github.com/quavedev/blaze-timezone-picker
https://github.com/quavedev/blaze-timezone-picker
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/quavedev/blaze-timezone-picker
- Owner: quavedev
- Created: 2021-12-09T13:12:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-09T13:28:55.000Z (over 4 years ago)
- Last Synced: 2025-02-27T21:45:05.271Z (over 1 year ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Timezone Picker
A meteor.js package that allows you to detect client-side timezones and gives you an interface for changing those timezones from user inputs.
## Getting started
### Install
Just run
```
meteor add quave:blaze-timezone-picker
```
### Add the timezone picker calls
Now we just have to add a startup block on the client to detect timezones:
```
// set the user's timezone
Deps.autorun(function() {
if (!Meteor.user().profile.timezone) {
Meteor.users.update(Meteor.userId(), {$set: {
'profile.timezone': TimezonePicker.detectedZone()
}});
}
});
```
Then we can add a quick form field to a profile settings form:
```
{{> timezonePicker class="form-group" selected=timezone}}
```
This will inject a select element with all the available moment-timezone timezones as options.
If the user's profile is the context for this template, it should pick up the timezone string we set on loading the page.