How do you get DatePicker to show the initial date correctly

Lloyd Sheen 1,331 Reputation points

Pretty much as in the title. The display on the DatePicker is the 1900 date. In the documentation it says the initial date is DateTime.Now but when it displays it shows 1900-01-01. If you query the value it is correct. So it works correctly but shows the user the incorrect info. I have searched all over and I can see others complaining buy MS just says it has been resolved. I guess the resolution is not to use the DatePicker.

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,630 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Albert Kallal 4,486 Reputation points

    Hum, what version of Maui? with .net core 8 version, (latest)? If I drop in a date control, say like this:


    And then run, for windows app, I get/see this: User's image

    And if I run as android (emulator), then I get this: User's image

    So, the date picker will default as today's date, but that assumes the date picker is un-bound (does not have a Binding expression. So, you may well have to provide a bit more markup, but out of the box, the above shows the DatePicker does default to today for the default date. If you have a binding expression, then of course the date will come from the data source being used, and if null, then of course you get the 1900 date value.