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

Time zone for NOW button

4 Answers 426 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Doug asked on 19 Nov 2020, 08:43 PM
With Blazor server, clicking the NOW button (obviously) sets the time to the time on the server since that's where the code is running. Is there a way to trap the NOW button click or somehow give it an offset or define the value that NOW means so NOW will mean the time that the user is sitting in?

4 Answers, 1 is accepted

Sort by
1
Marin Bratanov
Telerik team
answered on 20 Nov 2020, 08:46 AM

Hello Doug,

I made the following feature request for your to Follow: https://feedback.telerik.com/blazor/1496094-time-zone-for-now-button. At the moment, I don't think I can offer a feasible solution (apart from maybe hiding that button with CSS if it's an issue for you). The NOW button will trigger the ValueChanged event an then OnChange, but those can be triggered by the user typing or selecting things, and those scenarios are quite different - when they type/choose from the spinners you can apply the offset you know they have (say, because they have set a time zone in their accounts).

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 08 Feb 2021, 05:41 PM

Hi Marin,

I've had to revisit this issue. We've decided that it would be an acceptable solution to remove the NOW button from the datetime picker as you suggest. I'm not an expert with CSS (especially when it comes to applying it to Telerik controls) so would you mind providing me the CSS to hide the NOW button? Thanks.

1
Marin Bratanov
Telerik team
answered on 08 Feb 2021, 05:47 PM

Hi Doug,

This blog post can help you create such CSS overrides yourself. Here is also an example I made for you:

<style>
    .no-now-button .k-time-now {
        display: none;
    }
</style>

Selected time: @selectedTime
<br />

<TelerikDateTimePicker PopupClass="no-now-button"
                       Min="@Min" Max="@Max" @bind-Value="@selectedTime"
                       Format="dd MMM yyyy HH:mm:ss" Width="250px"></TelerikDateTimePicker>

@code {
    private DateTime? selectedTime = DateTime.Now;
    public DateTime Min = new DateTime(1990, 1, 1, 8, 15, 0);
    public DateTime Max = new DateTime(2025, 1, 1, 19, 30, 45);
}

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 08 Feb 2021, 05:52 PM

Marin,

That works perfectly! Thanks for the quick response!

Tags
DateTimePicker
Asked by
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Marin Bratanov
Telerik team
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or