May 30 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
May 30 | 7:35 PM |
Mark | has entered the room |
Mark |
hey mark
|
Mark M. |
hello, Mark!
|
Mark M. |
how can I help you today?
|
Mark M. |
(besides complimenting you on your awesome first name)
|
Mark |
haha
|
May 30 | 7:40 PM |
Mark |
I'm having some trouble setting the minDate on a DatePicker. I have 2 DatePicker widgets. If I select a date from the first one, I want to make that the minDate int the second one
|
Mark |
I set the listener and it gets hit and calls this method
|
Mark |
View paste
|
Mark |
unfortunately a min date is not set
|
Mark M. |
what are you using for LocalDate? the one from the Android SDK? Joda Time? ThreeTenABP?
|
Mark |
threeten
|
May 30 | 7:45 PM |
Mark M. |
hmmm... Jake's repo isn't behaving for me, and I'm not seeing toEpochSecond() on LocalDateTime...
|
Mark M. |
anyway, you're sure your code is getting called? and does startOfTheDay look OK?
|
Mark |
View paste
|
May 30 | 7:50 PM |
Mark M. |
I don't see toEpochSecond() there either -- perhaps it's a Kotlin extension function
|
Mark M. |
anyway, either secondsSince1970 is coming out wrong, or DatePicker is not liking the changed minDate for some other reason
|
Mark |
it is inherited through ChronoZonedDateTime
|
Mark M. |
ah, OK, I see it now
|
Mark M. |
I'd try changing SecondPickerDialog.datePicker.minDate = secondsSince1970 to use a known good value -- use https://www.epochconverter.com/ or something to get that value
|
Mark M. |
if that works, then your problem is in your conversion code
|
Mark M. |
if that fails, then your problem is in DatePicker
|
Mark M. |
there are a variety of calendar widgets available in the Android Arsenal if DatePicker turns into a problem
|
Mark |
the debugger displays 2019-06-20T00:00 for june 20
|
May 30 | 7:55 PM |
Mark |
ok
|
Mark M. |
check the secondsSince1970 value on https://www.epochconverter.com/, since it can convert both ways
|
Mark |
thank you
|
Mark |
i will
|
Mark |
before i go, I changed to different values in updateDate and noticed the calendar and the bar above can show different dates
|
Mark M. |
what device are you testing on? is this consistent across multiple devices?
|
Mark |
an emulated pixel
|
Mark M. |
OK, that's really strange, as that should be a clean implementation
|
Mark M. |
there is always the risk of a device manufacturer tinkering with these things and screwing something up, which is why I asked
|
Mark M. |
I haven't used DatePicker in quite some time, and if I needed a date picker, I'd be using one of the library implementations, most likely
|
Mark |
i have not tested across different devices. So regardless of the values passed to updateDate the calendar widget and the bar above it showing the date should always be in sync? I was afraid that maybe updateDate only affecte the bar above since that is always updating. Sometimes the calendar itself doesnt
|
May 30 | 8:00 PM |
Mark |
ok
|
Mark M. |
I haven't even *looked* at a DatePicker in probably 2 years, so I'm not 100% certain what the behavior is supposed to be, but off the cuff, what you describe sounds strange
|
Mark |
I will test with some other emualted devices
|
Mark M. |
focus on different OS versions
|
Mark |
OK
|
Mark M. |
the emulator "device" is just for things like screen resolution
|
Mark |
thank you and goodnight
|
Mark M. |
you're welcome!
|
Mark | has left the room |
May 30 | 8:25 PM |
Mark M. | turned off guest access |