Skip to content

Datepicker with an empty ng-model  #295

@aurenda

Description

@aurenda

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) : "";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions