Does compose material provide a Date Picker which ...
# compose
s
Does compose material provide a Date Picker which is only for year/month without a day selection? I’ve been looking at the material3 latest alpha release and it doesn’t look like it, but maybe I’m missing something 👀
a
Is there such component in material design? If no, I don't think there will be in compose.
s
I’ve been trying to find one too and you are right, it doesn’t seem to exist, I feel like I must’ve dreamt seeing it or something, I was sure it exists but it’s nowhere to be found. That’s my bad 🫣
Hmm okay I see this https://m3.material.io/components/date-pickers/specs#165089c3-1611-4e63-8a0a-c1aec67bea09 here, it’s a month selector specified in the specs, but I don’t see an API to access that view in the current DatePicker implementation. It may be that I am either missing smth or the that implementation isn’t there yet/
m
There’s always the option of writing a wrapper using AndroidView around the CalendarView xml control. https://stackoverflow.com/questions/60417233/jetpack-compose-date-time-picker
There’s also a link in there to a library someone made of different kinds of dialogs, but i admit, i have not given that a look.
s
I ended up basically copying the entire code off of material3 library since everything aside from the DatePicker API is internal, so that I can edit the code so that it shows the year picker and everything else the same, but replaced the date grid with the month column picker as shown in the specs I linked above. I assume this will at some point also be served from the library itself but this will suffice for now.
333 Views