Validating date range in any format with jquery UI datepickers

Validating date range in any format with jquery UI datepickers

Hi,

I am using two datepickers as laid out here:

http://jsfiddle.net/mQRaj/7/

The issue i am having is as follows. I have two datepickers that are going to be localised into many languages, therefore will have many date formats possible as their output.

My thinking was to take the output from the datepicker inputs and then convert it into a 'dd/mm/yy' format with the dateFormat method:

http://docs.jquery.com/UI/Datepicker/formatDate

This seems to work fine for datepickers where the date format is just numbers e.g. 'mm/dd/yy', 'yy-mm-dd' but not when you use formats that output Month names etc.

It returns NaN which i can understand but do not know how to fix. Apologies for the messy code.

If the date format is already 'dd/mm/yy' then i get odd results as well in that i would expect the same to be output..