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

Make it possible to update timezone using events #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ This fork of angular-datepicker contains several features.
* `format`: Format string used to display dates on the input field. Set to default value if this value is falsy.
* See: [format options](http://momentjs.com/docs/#/displaying/format/)
* This option cannot be used on the `date-picker` directive directly, it must be used on a `date-time` input field.
* `timezone`: Time zone to use
* The possible for the `view`, `minView` and `maxView` fields are:
* `year`, `month`, `date`, `hours`, `minutes`.
* The event is targeted at specific pickers using their `ID` attributes.
Expand Down Expand Up @@ -125,4 +126,4 @@ $scope.$broadcast('pickerUpdate', 'pickerToUpdate', {
$scope.$broadcast('pickerUpdate', ['pickerToUpdate', 'secondPickerToUpdate'], {
format: 'lll'
});
```
```
4 changes: 4 additions & 0 deletions app/scripts/datePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function
attrs.maxView = data.maxView;
updateViews = true;
}
if (angular.isDefined(data.timezone)) {
tz = scope.tz = data.timezone;
updateViewData = true;
}
attrs.view = data.view || attrs.view;

if (updateViews) {
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
if (angular.isDefined(data.maxView)) {
attrs.maxView = data.maxView;
}
if (angular.isDefined(data.timezone)) {
timezone = attrs.timezone = data.timezone;
validateRequired = true;
}
attrs.view = data.view || attrs.view;

if (validateRequired) {
Expand Down