Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

md-datepicker: support string representation of date as a model #6253

@lwj5

Description

@lwj5

The datepicker currently throws error if model given is not a date instance.
With parseDate function available, it would be helpful check if valid dateString is given before throwing an error.

Possible replacement of line 256-259 ref: pull #5503 of src/components/datepicker/datePicker.js:

  if (value && !(value instanceof Date)) {
    var parseValue = self.dateLocale.parseDate(value);
    if (isNaN(parseValue)) {
        throw Error('The ng-model for md-datepicker must be a Date instance. ' +
        'Currently the model is a: ' + (typeof value));
    } else {
        value = parseValue;
    }
  }

Up for discussion

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions