One possible solution is to add constant Calendar.DAY_OF_YEAR  (currently 
missing)

Then add this function to Calendar component:
        public int getDayOfYear(long time) {
            java.util.Calendar cal = java.util.Calendar.getInstance(tmz);
            cal.setTime(new Date(time));
            return cal.get(6);
        }  // 6 should be replaced with constant Calendar.DAY_OF_YEAR


Then change the comparison line in Calendar component (line 733 or close) to
                    if(getDayOfYear(dates[j]) == getDayOfYear(selectedDay)){
                        buttons[j].setUIID("CalendarSelectedDay");
                        ...



On Thursday, March 16, 2017 at 7:05:15 AM UTC-7, [email protected] wrote:
>
> IDE: Eclipse
> Simulator / Android (Samsung S5 and Tab S)
>
> To reproduce just run phoenix demo app, or create simple test app with 
> Calendar component.
> Since DST began, selected day is not highlighted.  (ie: today 3/16 is not 
> highlighted, but 4/16 is).  If I set my system clock back to 3/12 it works 
> just fine, or if Ii set it to April 1.  It's only if the date is between 
> 3/13 - 3/31. I assume it will also fail in the month of November when DST 
> ends.  You can see in the log below, the problem is that the check for 
> selectedDay and the increment of +DAY is not considering DST and as such is 
> comparing DAY @ 1:00am to DAY @ 2:00am
>
> Adding the below println just before the selectedday check shows, that 
> because of DST the hour has shifted by one
>              System.out.println(new SimpleDateFormat("MM/dd/yyyy 
> hh:mm:ss").format(new Date(startDate)) + " dates[j]:" + dates[j] + " 
> selected:" + selectedDay);
>                     if(dates[j] == selectedDay){
>                         buttons[j].setUIID("CalendarSelectedDay");
>
>
> you can see the log here:
> 03/01/2017 01:00:00 dates[j]:1488358800000 selected:1489651200000
> 03/02/2017 01:00:00 dates[j]:1488445200000 selected:1489651200000
> 03/03/2017 01:00:00 dates[j]:1488531600000 selected:1489651200000
> 03/04/2017 01:00:00 dates[j]:1488618000000 selected:1489651200000
> 03/05/2017 01:00:00 dates[j]:1488704400000 selected:1489651200000
> 03/06/2017 01:00:00 dates[j]:1488790800000 selected:1489651200000
> 03/07/2017 01:00:00 dates[j]:1488877200000 selected:1489651200000
> 03/08/2017 01:00:00 dates[j]:1488963600000 selected:1489651200000
> 03/09/2017 01:00:00 dates[j]:1489050000000 selected:1489651200000
> 03/10/2017 01:00:00 dates[j]:1489136400000 selected:1489651200000
> 03/11/2017 01:00:00 dates[j]:1489222800000 selected:1489651200000
> 03/12/2017 01:00:00 dates[j]:1489309200000 selected:1489651200000
> 03/13/2017 02:00:00 dates[j]:1489395600000 selected:1489651200000
> 03/14/2017 02:00:00 dates[j]:1489482000000 selected:1489651200000
> 03/15/2017 02:00:00 dates[j]:1489568400000 selected:1489651200000
> 03/16/2017 02:00:00 dates[j]:1489654800000 selected:1489651200000
> 03/17/2017 02:00:00 dates[j]:1489741200000 selected:1489651200000
> 03/18/2017 02:00:00 dates[j]:1489827600000 selected:1489651200000
> 03/19/2017 02:00:00 dates[j]:1489914000000 selected:1489651200000
> 03/20/2017 02:00:00 dates[j]:1490000400000 selected:1489651200000
> 03/21/2017 02:00:00 dates[j]:1490086800000 selected:1489651200000
> 03/22/2017 02:00:00 dates[j]:1490173200000 selected:1489651200000
> 03/23/2017 02:00:00 dates[j]:1490259600000 selected:1489651200000
> 03/24/2017 02:00:00 dates[j]:1490346000000 selected:1489651200000
> 03/25/2017 02:00:00 dates[j]:1490432400000 selected:1489651200000
> 03/26/2017 02:00:00 dates[j]:1490518800000 selected:1489651200000
> 03/27/2017 02:00:00 dates[j]:1490605200000 selected:1489651200000
> 03/28/2017 02:00:00 dates[j]:1490691600000 selected:1489651200000
> 03/29/2017 02:00:00 dates[j]:1490778000000 selected:1489651200000
> 03/30/2017 02:00:00 dates[j]:1490864400000 selected:1489651200000
> 03/31/2017 02:00:00 dates[j]:1490950800000 selected:1489651200000
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/abff718a-14a7-41b3-84e3-b7fa593af296%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to