Skip to content

Commit

Permalink
Removing angular moment, for backward comptibility issue #149
Browse files Browse the repository at this point in the history
  • Loading branch information
eralha committed Sep 28, 2015
1 parent c1ad097 commit 2f1ff2b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-datepicker",
"license": "MIT",
"version": "1.0.15",
"version": "1.0.17",
"main": [
"./dist/angular-datepicker.js",
"./dist/angular-datepicker.css"
Expand Down
20 changes: 15 additions & 5 deletions dist/angular-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(function(angular){
'use strict';

var Module = angular.module('datePicker', ['angularMoment']);
var Module = angular.module('datePicker', []);

Module.constant('datePickerConfig', {
template: 'templates/datepicker.html',
Expand Down Expand Up @@ -410,7 +410,8 @@ angular.module('datePicker').factory('datePickerUtils', function(){
isValidDate : function(value) {
// Invalid Date: getTime() returns NaN
return value && !(value.getTime && value.getTime() !== value.getTime());
},
}
/*
toMomentFormat : function(angularFormat) {
function replaceAll(find, replace, string) {
return string.replace(new RegExp(find, 'g'), replace);
Expand All @@ -424,6 +425,7 @@ angular.module('datePicker').factory('datePickerUtils', function(){
momentFormat = replaceAll('w', 'W', momentFormat);
return momentFormat;
}
*/
};
});
'use strict';
Expand Down Expand Up @@ -499,8 +501,8 @@ Module.directive('dateTimeAppend', function () {
};
});

Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfig', '$parse', 'datePickerUtils', 'moment',
function ($compile, $document, $filter, dateTimeConfig, $parse, datePickerUtils, moment) {
Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfig', '$parse', 'datePickerUtils',
function ($compile, $document, $filter, dateTimeConfig, $parse, datePickerUtils) {
var body = $document.find('body');
var dateFilter = $filter('date');

Expand Down Expand Up @@ -529,14 +531,22 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
return dateFilter(value, format);
}

/*
function parser(viewValue) {
if(viewValue.length === format.length) {
var date = moment(viewValue, datePickerUtils.toMomentFormat(format));
if(date.isValid()) {
clear();
return date.toDate();
}
return undefined;
return viewValue;
}
return undefined;
}
*/
function parser(viewValue) {
if(viewValue.length === format.length) {
return viewValue;
}
return undefined;
}
Expand Down
Loading

0 comments on commit 2f1ff2b

Please sign in to comment.