fng-bootstrap-datetime 0.12.0-beta.19 → 0.12.0-beta.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,8 +98,10 @@ angular.module('ui.bootstrap.datetimepicker', ["ui.bootstrap.dateparser", "ui.bo
98
98
  }
99
99
 
100
100
  var dateTmpl = "<div class=\"datetimepicker-wrapper\">" +
101
- "<input class=\"form-control\" type=\"text\" " +
101
+ "<input class=\"form-control\" " +
102
+ "type=\"text\" " +
102
103
  "name=\"datepicker\"" +
104
+ 'aria-label="' + (attrs.name || attrs.ngModel).replace(/[\.,-]/g, ' ') + '"' +
103
105
  "ng-change=\"date_change($event)\" " +
104
106
  "is-open=\"innerDateOpened\" " +
105
107
  "datepicker-options=\"dateOptions\" " +
@@ -156,6 +158,17 @@ angular.module('ui.bootstrap.datetimepicker', ["ui.bootstrap.dateparser", "ui.bo
156
158
  },
157
159
  controller: ['$scope', '$attrs',
158
160
  function ($scope, $attrs) {
161
+ var form;
162
+ function getForm() {
163
+ if (!form) {
164
+ var workingScope = $scope;
165
+ while (typeof workingScope.topLevelFormName !== "string" && workingScope.$parent) {
166
+ workingScope = workingScope.$parent;
167
+ }
168
+ form = workingScope[workingScope.topLevelFormName];
169
+ }
170
+ }
171
+ getForm();
159
172
  $scope.date_change = function () {
160
173
  // If we changed the date only, set the time (h,m) on it.
161
174
  // This is important in case the previous date was null.
@@ -166,11 +179,13 @@ angular.module('ui.bootstrap.datetimepicker', ["ui.bootstrap.dateparser", "ui.bo
166
179
  $scope.ngModel.setHours(time.getHours(), time.getMinutes(), 0, 0);
167
180
  $scope.ngModel = new Date($scope.ngModel); // By default, ngModel watches the model by reference, not value. This is important to know when binding inputs to models that are objects (e.g. Date) (from: https://docs.angularjs.org/api/ng/directive/ngModel)
168
181
  }
182
+ form.$setDirty();
169
183
  };
170
184
  $scope.time_change = function () {
171
185
  if ($scope.ngModel && $scope.time) {
172
186
  $scope.ngModel.setHours($scope.time.getHours(), $scope.time.getMinutes(), 0, 0);
173
187
  $scope.ngModel = new Date($scope.ngModel); // By default, ngModel watches the model by reference, not value. This is important to know when binding inputs to models that are objects (e.g. Date) (from: https://docs.angularjs.org/api/ng/directive/ngModel)
188
+ form.$setDirty();
174
189
  } // else the time is invalid, keep the current Date value in datepicker
175
190
  };
176
191
  $scope.open = function ($event) {
@@ -387,7 +402,9 @@ angular.module('ui.bootstrap.datetimepicker', ["ui.bootstrap.dateparser", "ui.bo
387
402
  jsonDateOptions = JSON.parse(processedAttr.directiveOptions['date-options'].replace(/'/g, '"'));
388
403
  }
389
404
  scope.dateOptions = Object.assign({}, overRiddenDateDefaults, jsonDateOptions);
390
- template = pluginHelper.buildInputMarkup(scope, attrs.model, processedAttr.info, processedAttr.options, false, false, function (buildingBlocks) {
405
+
406
+ const isArray = processedAttr.info.array;
407
+ template = pluginHelper.buildInputMarkup(scope, attrs.model, processedAttr.info, processedAttr.options, isArray, isArray, function (buildingBlocks) {
391
408
  var str = '<div class="dtwrap"><datetimepicker ' + buildingBlocks.common;
392
409
  for (var opt in overRiddenDefaults) {
393
410
  if (opt !== 'date-options') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-bootstrap-datetime",
3
- "version": "0.12.0-beta.19",
3
+ "version": "0.12.0-beta.190",
4
4
  "description": "datetime input plugin for forms-angular",
5
5
  "main": "fng-bootstrap-datetime.js",
6
6
  "scripts": {