Atomic Spin has a great article on setting up Pikaday with an
However, since I'm using Ember Data with some
date attributes, I needed to actually use a
Date object rather than a formatted date string. Here's what I came up with after adding a few things to their example:
There were a couple things I had to add for this to work:
- I'm using the moment.js library to allow
- I format the existing date in the
- Rather than binding the attribute directly to the
value, I'm using a
datebinding instead. This gives me the chance to parse a formatted date before setting the attribute.
- Two-way binding to the date:
updateDatefunction, which observes
value, directly sets the
dateto the parsed value.
updateValuefunction, which observes
date, updates the
valuewith the formatted date.