1

Been having a poke around and I am trying to be able to get the individual sections of the date chosen by the date picker as vars, so they can be used outside the .datepicker function.

Is there an array I can access to grab this data?

You can format the date as one of the functions options using dateFormat: "dd mm yy" etc, so there must be a way just to set dd as var day mm as var month etc.

2
  • All those are private to the datepicker and to my knowledge there is no way to get them out (unless to modify their source), Out of curiosity why do you need it? Commented Oct 5, 2010 at 14:01
  • @Teja Kantamneni I want to be able to have a select field which a user selects the duration of an event. This duration will just add onto the date selected in the datepicker to give a finish date. Commented Oct 5, 2010 at 14:06

2 Answers 2

1

Do you know about the getDate and setDate methods of the datepicker ?

quoting the setDate

The new date may be a Date object or a string in the current date format (e.g. '01/26/2009'), a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null to clear the selected date.

Sign up to request clarification or add additional context in comments.

Comments

1

We have two steps here:

  1. Fetch selected date: the getDate method "Returns the current date for the datepicker or null if no date has been selected"

  2. Format the date as string: the formatDate utility function "Format a date into a string value with a specified format"

Follow the links for some usage examples.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.