Skip to content

Commit

Permalink
Fix string comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Ugoku committed Feb 23, 2018
1 parent beb875f commit 5dd2a70
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-moment-duration",
"version": "0.0.7",
"version": "0.0.8",
"homepage": "https://github.com/Recras/angular-moment-duration",
"description": "An AngularJS directive for moment.js duration",
"main": "./src/angular-moment-duration.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-moment-duration",
"version": "0.0.7",
"version": "0.0.8",
"description": "An AngularJS directive for moment.js duration",
"main": "src/angular-moment-duration.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/angular-moment-duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ angular.module('ui.moment-duration', [])

ngModel.$viewChangeListeners.push(function() {
var valid = true;
if (attrs.min && ngModel.$viewValue < attrs.min) {
if (attrs.min && parseInt(ngModel.$viewValue, 10) < parseInt(attrs.min, 10)) {
valid = false;
} else if (attrs.max && ngModel.$viewValue > attrs.max) {
} else if (attrs.max && parseInt(ngModel.$viewValue, 10) > parseInt(attrs.max, 10)) {
valid = false;
}
ngModel.$setValidity('min', valid);
Expand Down

0 comments on commit 5dd2a70

Please sign in to comment.