On 10 Mar 2015 18:56, "Manuel" <develop.m...@gmail.com> wrote:
>

>             // Copy day/month/year to the datebox
>             startDate.setYear(selectedDate.getYear());
>             startDate.setMonth(selectedDate.getMonth());
>             startDate.setDate(selectedDate.getDate());
>

Perhaps you should remember the year/month/date you want another way.

Also, copying the year, month and date like that from one date instance to
another is fundamentally broken. It will usually do what you expect but not
always.

For example, if you have 2015-02-20 and copy that to a date that starts off
as 2015-03-31, then copying the year will change nothing because they are
already the same. Copying the month will give the value 2015-02-31 which
doesn't exist. So it will interpret that to mean 2015-03-03, since 31st Feb
is 3 days beyond the end of February (in 2015).

You finally copy the day, and so end up with 2015-03-20 when you thought
you would get 2015-02-20.

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to