fng-bootstrap-date 0.12.0-beta.178 → 0.12.0-beta.180

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.
@@ -47,7 +47,12 @@
47
47
  if (processedAttr.directiveOptions['date-options']) {
48
48
  jsonDateOptions = JSON.parse(processedAttr.directiveOptions['date-options'].replace(/'/g, '"'));
49
49
  }
50
- scope.dateOptions = Object.assign({}, overRiddenDateDefaults, jsonDateOptions);
50
+ scope.dateOptions = Object.assign(overRiddenDateDefaults, jsonDateOptions);
51
+ ["minDate","maxDate"].forEach(v => {
52
+ if (scope.dateOptions[v] && typeof scope.dateOptions[v] === "string") {
53
+ scope.dateOptions[v] = new Date(scope.dateOptions[v]);
54
+ }
55
+ })
51
56
 
52
57
  const isArray = processedAttr.info.array;
53
58
  template = pluginHelper.buildInputMarkup(scope, attrs.model, processedAttr.info, processedAttr.options, isArray, isArray, function (buildingBlocks) {
@@ -67,14 +72,14 @@
67
72
  const random = Math.floor(Math.random() * 10000);
68
73
  scope[prefix + random] = {
69
74
  opened: {}
70
- };
75
+ };
71
76
  scope["open" + random] = function ($index) {
72
77
  const all = Object.keys(scope).filter((k) => k.startsWith(prefix));
73
78
  for (const key of all) {
74
79
  scope[key].opened = {};
75
80
  }
76
81
  scope[prefix + random].opened[$index || 0] = true;
77
- }
82
+ }
78
83
  return formMarkupHelper.generateSimpleInput(
79
84
  buildingBlocks.common + str + ' validdate datepicker-options="dateOptions" uib-datepicker-popup="' + (processedAttr.directiveOptions.format || processedAttr.directiveOptions['date-format'] || 'dd/MM/yy') + '" is-open="' + prefix + random + '.opened[$index || 0]" ng-click="open' + random + '($index)" ' + formMarkupHelper.addTextInputMarkup(buildingBlocks, processedAttr.info, ''),
80
85
  processedAttr.info,
@@ -116,7 +121,7 @@
116
121
  }
117
122
  var retVal = true;
118
123
  if (minDate || maxDate) {
119
- var dateVal = new Date(parseInt(viewValue.slice(6,10),10), parseInt(viewValue.slice(3,5),10)-1,parseInt(viewValue.slice(0,2),10)).valueOf();
124
+ var dateVal = modelValue.valueOf();
120
125
  if (minDate && dateVal < minDate) {
121
126
  retVal = false;
122
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-bootstrap-date",
3
- "version": "0.12.0-beta.178",
3
+ "version": "0.12.0-beta.180",
4
4
  "description": "Date input plugin for forms-angular, using the Bootstrap datepicker from Angular-ui-bootstrap",
5
5
  "main": "fng-bootstrap-date.js",
6
6
  "scripts": {