Android Question [B4X] AS DatePicker possible bug

Aldo's

Active Member
Licensed User
Using the library in question I inserted the following code to have a calendar that starts with Sunday.
B4X:
    DateTime.DateFormat="dd/MM/yyyy"
    DateTime.SetTimeZone(1)
    dpData.MinDate=DateTime.DateParse("01/12/2019")
    dpData.MaxDate=DateTime.DateParse("02/12/2051")
    dpData.FirstDayOfWeek=6
    dpData.WeekNameShort=dpData.CreateASDatePicker_WeekNameShort("DO","LU","MA","ME","GI","VE","SA")
    dpData.MonthNameShort=dpData.CreateASDatePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    dpData.Refresh
Going from March to April it performs a strange display by repeating the empty month of March and putting only a few days of April. In the following months the situation did not recover.
Is this a bug?
 

Aldo's

Active Member
Licensed User
If you change this property outside of the designer, then you need to call ".Rebuild" and not "Refresh"
I wrote:
B4X:
    DateTime.DateFormat="dd/MM/yyyy"
    DateTime.SetTimeZone(1)
    dpData.MinDate=DateTime.DateParse("01/12/2019")
    dpData.MaxDate=DateTime.DateParse("02/12/2051")
    dpData.FirstDayOfWeek=6
    dpData.Rebuild
    dpData.WeekNameShort=dpData.CreateASDatePicker_WeekNameShort("DO","LU","MA","ME","GI","VE","SA")
    dpData.MonthNameShort=dpData.CreateASDatePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    dpData.Refresh
and I got the following error:
Error occurred on line: 699 (ASViewPager)
*** -[__NSArrayM objectAtIndex:]: index 12 beyond bounds for empty array
Stack Trace: (
CoreFoundation 1B48137D-6256-3164-9EC3-124F0AA34B77 + 935812
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation CFSetContainsValue + 0
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
dpData.Rebuild
If you call this, then you dont need to call:
dpData.Refresh
Set all the settings you want to make and then call .Rebuild. If you call up .Rebuild and then .Refresh immediately afterwards, it will run into an error because it takes a while to build the list.
 
Upvote 0

Aldo's

Active Member
Licensed User
I also tried this:
B4X:
    DateTime.DateFormat="dd/MM/yyyy"
    DateTime.SetTimeZone(1)
    dpData.MinDate=DateTime.DateParse("01/12/2019")
    dpData.MaxDate=DateTime.DateParse("02/12/2051")
    dpData.WeekNameShort=dpData.CreateASDatePicker_WeekNameShort("DO","LU","MA","ME","GI","VE","SA")
    dpData.MonthNameShort=dpData.CreateASDatePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    dpData.Refresh
setting the First Day of Week as Designer.
The behavior is the same.
 
Upvote 0

Aldo's

Active Member
Licensed User
I see the error, I have to change something internally.
Thanks.
If it is useful to you, if you choose the month from the year it no longer causes any problems.
 
Upvote 0

Aldo's

Active Member
Licensed User
I have also tested it with B4I, but more detailed information would be helpful.
In March, when I press the right arrow to go to April, it shows me at the top (as if they were the first days of the month) only the 29th and 30th of April. If I press again to go to May, it always shows me up from the 27th to the 31st... and so on for the following months.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Don't understand why you have to set a time zone.
It is not recommended:
 
Upvote 0

Aldo's

Active Member
Licensed User
Don't understand why you have to set a time zone.
Because if I don't put it it recognizes the difference between the time zone of the system and that of the control. I need a perfect value at 0:00:00 because I build an index with it. However, I try to remove that value and correct the value for building the index from the code.
I'll try and tell you.
 
Upvote 0

Aldo's

Active Member
Licensed User
I tried. It makes everything look right but it skips April, then September, then February 2025...
 
Upvote 0

Aldo's

Active Member
Licensed User
I put version 1.27 of the library back and everything works perfectly.
Thank you very much.
 
Upvote 0
Top