KEMBAR78
Add converters to DatePicker and TimePicker for DateOnly and TimeOnly by symbiogenesis · Pull Request #21989 · dotnet/maui · GitHub
Skip to content

Conversation

@symbiogenesis
Copy link
Contributor

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.

@symbiogenesis symbiogenesis requested a review from a team as a code owner April 23, 2024 03:13
@symbiogenesis symbiogenesis requested review from Eilon and PureWeen April 23, 2024 03:13
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 23, 2024
@symbiogenesis symbiogenesis changed the title Add converters to DatePicker and TimePicker for DateOnly and TimeOnly, respectively Add converters to DatePicker and TimePicker for DateOnly and TimeOnly Apr 23, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

@jsuarezruiz jsuarezruiz added the t/enhancement ☀️ New feature or request label Apr 23, 2024
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Apr 26, 2024
@jsuarezruiz
Copy link
Contributor

There are some compilation errors:

D:\a\_work\1\s\src\Controls\src\Core\TimePicker\TimePicker.cs(71,47): error CS0246: The type or namespace name 'TimeOnlyConverter' could not be found (are you missing a using directive or an assembly reference?) [D:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net8.0-windows10.0.19041.0]

@Eilon Eilon added area-controls-datetimepicker DatePicker, TimePicker and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels May 11, 2024
@symbiogenesis symbiogenesis force-pushed the dateonly-datepicker branch from 2f0f12b to 7ccb195 Compare June 6, 2024 00:53
@symbiogenesis
Copy link
Contributor Author

There are some compilation errors

Should be fixed now

@symbiogenesis
Copy link
Contributor Author

@Eilon

@symbiogenesis
Copy link
Contributor Author

This one would be nice to have. @Foda

@Foda
Copy link
Member

Foda commented Jan 15, 2025

This one would be nice to have. @Foda

A simple unit test would be great!

@jfversluis
Copy link
Member

@symbiogenesis are you still interested in completing this one? Else I will take over!

@symbiogenesis
Copy link
Contributor Author

@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.

@jfversluis
Copy link
Member

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 :)

@symbiogenesis
Copy link
Contributor Author

Ok, that makes sense. Must be why I didn't include those earlier.

Added some tests.

@jfversluis jfversluis force-pushed the dateonly-datepicker branch from cc01637 to dbbf5e1 Compare April 10, 2025 12:06
@jfversluis jfversluis requested review from a team and tj-devel709 as code owners April 10, 2025 12:06
@jfversluis jfversluis changed the base branch from main to net10.0 April 10, 2025 12:06
@rmarinho rmarinho force-pushed the dateonly-datepicker branch from 21bf61e to 98368cb Compare June 17, 2025 09:38
@rmarinho
Copy link
Member

/azp run

@dotnet dotnet deleted a comment from azure-pipelines bot Jun 17, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis added the p/0 Work that we can't release without label Jun 18, 2025
Copy link
Contributor

@StephaneDelcroix StephaneDelcroix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to implement IExtended, and require the serviceProvider


namespace Microsoft.Maui.Controls;

public class TimeSpanTypeConverter : TypeConverter, IExtendedTypeConverter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@PureWeen
Copy link
Member

#30790

@PureWeen PureWeen closed this Jul 25, 2025
@github-project-automation github-project-automation bot moved this from Changes Requested to Done in MAUI SDK Ongoing Jul 25, 2025
StephaneDelcroix pushed a commit to Vignesh-SF3580/maui that referenced this pull request Aug 21, 2025
allow bindings between DateTime properties and DateTimeOnly values. Same
to Time

- fixes dotnet#20438
- closes dotnet#21989
StephaneDelcroix pushed a commit to Vignesh-SF3580/maui that referenced this pull request Aug 21, 2025
allow bindings between DateTime properties and DateTimeOnly values. Same
to Time

- fixes dotnet#20438
- closes dotnet#21989
StephaneDelcroix pushed a commit that referenced this pull request Aug 21, 2025
allow bindings between DateTime properties and DateTimeOnly values. Same
to Time

- fixes #20438
- closes #21989
github-actions bot pushed a commit that referenced this pull request Aug 21, 2025
allow bindings between DateTime properties and DateTimeOnly values. Same
to Time

- fixes #20438
- closes #21989
rmarinho pushed a commit that referenced this pull request Aug 21, 2025
allow bindings between DateTime properties and DateTimeOnly values. Same
to Time

- fixes #20438
- closes #21989

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-datetimepicker DatePicker, TimePicker community ✨ Community Contribution p/0 Work that we can't release without t/enhancement ☀️ New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

XAML DatePicker Control Does Not Update DateOnly Items

9 participants