This is a migrated thread and some comments may be shown as answers.

TelerikDatePicker Format (Client-side)

1 Answer 173 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Henri
Top achievements
Rank 1
Henri asked on 14 May 2019, 06:31 AM

Dear Telerik,

I have a question regarding the TelerikDatePicker's Format property.
I have set the format to "dd/MM/yyyy"

<TelerikDatePicker Format="dd/MM/yyyy"  bind-Value="@DatePickerValue" ValueChanged="@OnDateChanged"></TelerikDatePicker>

But the Picker still displays the date as yyyy-MM-dd.

I have tried various ways, including setting the CultureInfo in different ways, but nothing seams to help.

Do you have a solution for this ?

 

Regads,

Gert

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 14 May 2019, 07:08 AM
Hello Gert,

Can you confirm you have the JS interop file registered, with the correct version, as explained here: https://docs.telerik.com/blazor-ui/components/dateinput/overview?

 Here's some code I used to test this, and at the end of this post you will find a screenshot of what I see in the browser:

@using Telerik.Blazor.Components.DateInput
 
Format="dd/MM/yyyy"
<TelerikDateInput Format="dd/MM/yyyy" bind-Value="@DatePickerValue"></TelerikDateInput>
 
<br />
No explicit format
<TelerikDateInput Format="dd/MM/yyyy" bind-Value="@DatePickerValue"></TelerikDateInput>
 
<br />
Format="yyyy MMM dd"
<TelerikDateInput Format="yyyy MMM dd" bind-Value="@DatePickerValue"></TelerikDateInput>
 
<br />
 
@DatePickerValue
 
@functions {
    DateTime DatePickerValue { get; set; } = DateTime.Now;
}

Also, version 1.1.0 is planned for tomorrow, so you could give that a try as well.

That said, we rely on the framework to provide the formatting and Blazor still has issues with date formatting and localization: https://github.com/aspnet/Blazor/issues/1166 and https://github.com/mono/mono/issues/6368. Also, at the moment, the ValueChanged handler is also blocked by this: https://github.com/aspnet/AspNetCore/issues/8385. The framework is still young and is bound to have some hiccups yet and date formatting and handling still seems to be one of them.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
Tags
General Discussions
Asked by
Henri
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or