Unplanned
Last Updated: 11 Dec 2021 09:49 by ADMIN
Doug
Created on: 20 Nov 2020 08:43
Category: DateTimePicker
Type: Feature Request
14
Time zone for NOW and TODAY button (or function to be called)

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?

---

ADMIN EDIT

One way this could land could be through templates for the header areas of the calendars - that would let you put your own NOW button there so you can handle its click and change the value as desired. So, you may want to follow and/or Vote for this approach here: https://feedback.telerik.com/blazor/1468855-header-template-for-the-calendars.

A workaround for the time being could be hiding the Now button with some CSS:

<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);
}

---

3 comments
ADMIN
Marin Bratanov
Posted on: 11 Dec 2021 09:49

Hi,

That is a good idea and I added it to the title of the page, as I think both should be considered at the same time.

Thank you for sharing.

Regards,
Marin Bratanov
Progress Telerik

Learn about the important changes coming in UI for Blazor 3.0 in January 2022!
NovaStor
Posted on: 09 Dec 2021 20:32

Would this also apply to the "Today" button?

Thank you.

Darren
Posted on: 17 Sep 2021 15:13
It would be more flexible if a function could be provided to supply the now button with the desired time.  We also have a need to default to midnight for DateTime.