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

fix(datepicker): support string in the non-HTML5 formatter - #6439

Open
byronigoe wants to merge 2 commits into
angular-ui:masterfrom
byronigoe:patch-1
Open

fix(datepicker): support string in the non-HTML5 formatter#6439
byronigoe wants to merge 2 commits into
angular-ui:masterfrom
byronigoe:patch-1

Conversation

@byronigoe

Copy link
Copy Markdown

support string in the non-HTML5 formatter, e.g. JSON date

The formatter for non-HTML5 inputs had logic to convert a Number into a Date (Object), but nothing for Strings (like JSON dates).

@wesleycho wesleycho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change, but I'm amenable to merging this otherwise.

Comment thread src/datepickerPopup/popup.js Outdated
}

if (angular.isNumber(value)) {
if (!angular.isObject(value)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to do !angular.isDate here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@byronigoe

Copy link
Copy Markdown
Author

For my use case of using a JSON date, I also needed to enhance the validator:
if (angular.isString(value)) {
return !isNaN(parseDateString(value)) || value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.000Z$/);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.