Skip to content

Commit

Permalink
Merge pull request #969 from marmelab/fix_datepicker
Browse files Browse the repository at this point in the history
[RFR] Fix Datepicker JS error
  • Loading branch information
RobinBressan committed Mar 21, 2016
2 parents d40ab91 + 88e9493 commit b8cb1b9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/javascripts/ng-admin/Crud/CrudModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ CrudModule.service('RestWrapper', require('./misc/RestWrapper'));

CrudModule.directive('maJsonValidator', require('./validator/maJsonValidator'));

CrudModule.directive('uibDatepickerPopup', require('./field/datepickerPopup'));
CrudModule.directive('maField', require('./field/maField'));
CrudModule.directive('maButtonField', require('./field/maButtonField'));
CrudModule.directive('maChoiceField', require('./field/maChoiceField'));
Expand Down
27 changes: 0 additions & 27 deletions src/javascripts/ng-admin/Crud/field/datepickerPopup.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maDateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function maDateField() {
link: function(scope, element) {
var field = scope.field();
scope.name = field.name();
scope.rawValue = scope.value;
scope.rawValue = scope.value == null ? new Date() : (scope.value instanceof Date ? scope.value : new Date(scope.value));
scope.$watch('rawValue', function(rawValue) {
scope.value = field.parse()(rawValue);
});
Expand Down
4 changes: 1 addition & 3 deletions src/javascripts/test/unit/Crud/field/maDateFieldSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ describe('directive: date-field', function() {
'use strict';

var dateDirective = require('../../../../ng-admin/Crud/field/maDateField');
var datepickerPopupDirective = require('../../../../ng-admin/Crud/field/datepickerPopup');
var DateField = require('admin-config/lib/Field/DateField');

angular.module('testapp_DateField', ['ui.bootstrap', 'ui.bootstrap.tpls'])
.directive('maDateField', dateDirective)
.directive('datepickerPopup', datepickerPopupDirective);
.directive('maDateField', dateDirective);

var $compile,
scope,
Expand Down

0 comments on commit b8cb1b9

Please sign in to comment.