Add converters to DatePicker and TimePicker for DateOnly and TimeOnly#21989
Add converters to DatePicker and TimePicker for DateOnly and TimeOnly#21989symbiogenesis wants to merge 12 commits intodotnet:net10.0from
Conversation
8e25fff to
2f0f12b
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
There are some compilation errors:
|
2f0f12b to
7ccb195
Compare
Should be fixed now |
|
This one would be nice to have. @Foda |
A simple unit test would be great! |
|
@symbiogenesis are you still interested in completing this one? Else I will take over! |
Looks like I had some changes locally that I didn't push, yet. So I just pushed those. Needs the conflicts resolved. If you could resolve those, I would be appreciative. |
|
I don't think adding the properties was part of the plan? The whole point of this was that it would convert TimeOnly and DateOnly to TimeSpan & DateTime right? So that we could use this with the existing properties. As mentioned in #27930 and #27921 unfortunately we can't use DateOnly and TimeOnly since they are not supported in netstandard. And as you pointed out yourself, we're going to have to support that for a while to come. So this seems like a nice in-between solution :) |
0167327 to
7ccb195
Compare
|
Ok, that makes sense. Must be why I didn't include those earlier. Added some tests. |
cc01637 to
dbbf5e1
Compare
21bf61e to
98368cb
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
StephaneDelcroix
left a comment
There was a problem hiding this comment.
DateTime and TimeSpan conversions are built-in, not sure wee ned to add a converter to support xOnly, but we might need to extend the support of the built-in conversion
could you please ad some xaml unit tests ?
also, this would need a compiled converter, or it'll slow xaml inflation of all files with dates or times in it
|
|
||
| namespace Microsoft.Maui.Controls; | ||
|
|
||
| public class DateTimeTypeConverter : TypeConverter, IExtendedTypeConverter |
There was a problem hiding this comment.
no need to implement IExtended, and require the serviceProvider
|
|
||
| namespace Microsoft.Maui.Controls; | ||
|
|
||
| public class TimeSpanTypeConverter : TypeConverter, IExtendedTypeConverter |
PureWeen
left a comment
There was a problem hiding this comment.
@symbiogenesis can you rebase and address @StephaneDelcroix 's comments?
If you don't have time currently just let me know and we can take over
allow bindings between DateTime properties and DateTimeOnly values. Same to Time - fixes dotnet#20438 - closes dotnet#21989
allow bindings between DateTime properties and DateTimeOnly values. Same to Time - fixes dotnet#20438 - closes dotnet#21989
I realize that full DateOnly and TimeOnly support is not implemented yet. This is a start in that direction.
Fixes #20438
As mentioned in the comments there, fixing that bug is merely a subset of #1100 which can be fixed without the need for a full implementation.