Skip to content

Datepicker with an empty ng-model #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aurenda opened this issue Jul 11, 2016 · 2 comments
Open

Datepicker with an empty ng-model #295

aurenda opened this issue Jul 11, 2016 · 2 comments

Comments

@aurenda
Copy link

aurenda commented Jul 11, 2016

Cannot have a datepicker with an empty ng-model because it shows invalid date or the current date. I think it would be a good idea to have an option to specify if I want to have a value when the model is initialized (with the current date) or an empty object (or string). There are some cases (such as having a form where the input field related to the datepicker is not required) when it is not necessary to select a date; it is confusing then that the current date appears always in the input field. I made a workaround for this and modified the code below sending an empty string in the function "formatter". This is only a workaround but I think a functionality like this will add value to your component.

function formatter(value) {
return value != "" ? dateFilter(value, format, timezone) : "";
}

@cipchk
Copy link

cipchk commented Jul 11, 2016

#199

@Dr1Ku
Copy link

Dr1Ku commented Aug 1, 2016

Would be fixed by PR https://github.com/g00fy-/angular-datepicker/pull/293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants