Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKryvets committed Apr 22, 2015
0 parents commit 65b29fd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ts.datetimeinput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(function (window, angular, undefined) {

'use strict';

angular.module('ts.datetimeInput', []).directive('tsDatetimeInput', ['dateFilter', function (dateFilter) {
return {
restrict: 'A',
require: 'ngModel',
link: function ($scope, $element, $attributes, $controller) {
$controller.$formatters = [function (value) {
return dateFilter(value, 'yyyy-MM-dd HH:mm');
}];
$controller.$parsers = [function (value) {
var date = new Date(value);
return date.getTime() > 0 ? date : null;
}];
}
};
}]);

})(window, window.angular);

0 comments on commit 65b29fd

Please sign in to comment.