Prashant P
Prashant P

Reputation: 23

Struts2-jQuery datepicker automatically changing format

The date picker is declared as below

<sj:datepicker title="%{getText('Choose_to_date')}" value="%{#attr.endDate}"

Now, when the value passed is something like 09/01/2013 when the page loads it automatically changes to 01/09/2013 This behavior is not seen if the value being set is 09/28/2013 i.e. if the number representing day > 12, all works fine.

Printed the value of attr.endDate into the logs and it shows up correctly

Been stuck with this issue for a day now :-(

Upvotes: 2

Views: 639

Answers (1)

Trick
Trick

Reputation: 3849

Add displayFormat attribute:

<sj:datepicker title="%{getText('Choose_to_date')}" value="%{#attr.endDate}" displayFormat="dd/mm/yyyy">

Or whatever format suits you.

Upvotes: 2

Related Questions