Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

dateformat dd.MM.yyyy #1118

Closed
AntonFend opened this issue Oct 3, 2013 · 1 comment
Closed

dateformat dd.MM.yyyy #1118

AntonFend opened this issue Oct 3, 2013 · 1 comment

Comments

@AntonFend
Copy link

if you set dateformat to 'dd.MM.yyyy' the 'new Date(viewValue)' (see bellow in the angular.IsString condition) parses the string like 'MM.dd.yyyy'

The TODO is not implemented yet

// TODO: reverse from dateFilter string to Date object
function parseDate(viewValue) {
viewValue = dateFilter(viewValue, dateFormat);
if (!viewValue) {
ngModel.$setValidity('date', true);
return null;
} else if (angular.isDate(viewValue)) {
ngModel.$setValidity('date', true);
return viewValue;
} else if (angular.isString(viewValue)) {
var date = new Date(viewValue);
if (isNaN(date)) {
ngModel.$setValidity('date', false);
return undefined;
} else {
ngModel.$setValidity('date', true);
return date;
}
} else {
ngModel.$setValidity('date', false);
return undefined;
}
}

@bekos
Copy link
Contributor

bekos commented Oct 5, 2013

@Anton2012 You can help / contribute here #1107. For a solution until then see #956.

@bekos bekos closed this as completed Oct 5, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants