0

I am using datepicker.js and it is returning a date object from the input.

    Console[Log] Object (test.html, line 229)
    date: 16
    day: 4
    month: 0
    obj: Thu Jan 16 2014 00:00:00 GMT-0700 (MST)
      __proto__: NaN
    pick: 1389855600000
    year: 2014
       __proto__: Object

I need to create labels for the next inputs based on this information. How do I change this object into the following format

Jan 16

and then I am running a loop to create the inputs/labels so how do i increment that based on the user choosing a number from a drop down list. Essentially if the first date picked is Jan 16, then I need Jan 17, Jan 18 etc.

user1881482
  • 746
  • 2
  • 16
  • 34
  • 6
    You might want to check out this very helpful library http://momentjs.com/. A few minutes in their documentation will give you exactly what you're looking for. – Clev3r Jan 01 '14 at 21:55
  • This cured it. I was trying to stay away from loading another JS library on my page, however, this one takes care of everything.If you answer this post with this info, I will mark it answered – user1881482 Jan 01 '14 at 23:56
  • possible duplicate of [Where can I find documentation on formatting a date in JavaScript](http://stackoverflow.com/questions/1056728/where-can-i-find-documentation-on-formatting-a-date-in-javascript) – Jonathan Lonowski Jan 02 '14 at 12:43

1 Answers1

0

As requested: you might want to check out momentjs, an awesome library for dealing with the terribleness of Date objects.

Clev3r
  • 1,568
  • 1
  • 15
  • 28