Hi,
In .net Maui SfDatePicker, I have a date with (dd_MM_yyyy), the picker format is the same, but always opens with "MM_dd_YYYY".
Sample in attach.
Regards,
Helder
Hi Helder,
Thank you for bringing this matter to our attention. Upon reviewing the information and sample you provided, we have investigated the reported issue regarding the date picker format not responding to the provided format in .NET MAUI DatePicker.
We are pleased to inform you that we were able to successfully address the issue by utilizing the Format property of the date picker. By adjusting the date format through this property, we were able to achieve the desired formatting, and it functioned as expected for the provided format.
To provide clarity and demonstrate the resolution, we have attached screenshots showcasing the date picker with different formats for your reference.
Screenshots:
|
yyyy_MM_dd format screenshot
|
dd_MM_yyyy format screenshot |
|
MM_dd_yyyy format screenshot
|
dd_MM format screenshot
|
Tested device:
Pixel 6 Pro API 33
Tested version:
25.1.39
To assist you more effectively, could you kindly clarify the specific issue or requirement you are encountering? Any additional information or context you can provide would greatly aid us in analyzing the situation and offering you a prompt solution.
Regards,
Indumathi R
Hi Indumathi ,
The date in my code is the first of April, not the 4th of January.
I'm using the Portuguese date format that is dd_MM_yyyy, and when put the first of April it opens with the 4th of January, that is the problem I'm facing.
Regards,
Helder
Hi Helder,
We are pleased to inform you that these modifications have resolved the date format issue, and the sample now functions as expected. For your convenience, we have attached the modified sample to this message. Please review it at your earliest convenience to confirm that the issue has been successfully resolved.
If you have any further questions or encounter any additional concerns, please do not hesitate to reach out. We are here to assist you in any way we can.
Code snippet:
|
public ViewModel() { DataMinima = Convert.ToDateTime("01-01-" + DateTime.Now.AddYears(-1).Year); DataMaxima = DateTime.Now.AddMonths(12);
TxtStartDate = "";
TxtStartDate = DateTime.Now.Month.ToString().PadLeft(2, '0')+"-01" + "-" + DateTime.Now.Year.ToString();
} |
We hope that this helps you. Please let us know if you need further assistance.
Regards,
Indumathi R
Hi Indumathi,
Than you for your assistance, the code you send fixes the problem, but makes no sence, passing a date in a different format so the picker can display it correctly.
Are you plannig to fix the datepicker, or this is a permanent walkaround?
Thank you.
Regards,
Helder
Hi Helder,
We would like to inform you that the SelectedDate property in the SfDatePicker is of type DateTime. When a value of type String is bound to the DateTime property, it automatically converts into a DateTime value from the framework side. This behavior is expected from the framework. Therefore, we suggested changing the string format type to resolve the reported scenario at the sample level in our previous update. Please let us know if you have any concerns.
Regards,
Devanathan Vaithiyanathan