JayData & Knockout & HTML 5: Date

Say you want to store an input type=”date” with knock out.

<input data-bind="value: HearDate" type="date" />

The HTML5 datepicker may not set the date even if you select a date.

It could be caused by the fact that you have define the field with type “date” or “datetime”.

$data.define('XXXX', {

    HearDate: { type: "date" }

});

If you switch it to “string”, then the HTML5 datepicker will work.

$data.define('XXXX', {

    HearDate: { type: "string" }

});

note: tried in Google Chrome only.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s