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

Seconds management with date/time picker, "modern" type

6 Answers 774 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Syleps
Top achievements
Rank 1
Veteran
Syleps asked on 20 Mar 2021, 09:22 AM
Hi,
I have a problem with the management of seconds with datetime picker with the "modern" type component: they are not displayed on popup (use of "G" format). Worse, the seconds are initialized with the current seconds (and not 0).
I can understand that there is a problem with the management of AM / PM hours, but that is not my case (24H display)
Is there a solution? apart from going back to "classic" mode, because for touch, the new version is more practical, and without using keyboard input (touchscreen mode)

On the other hand, is there a solution to use this component on a smartphone in landscape mode? (today, the popup is too high and goes out of the screen, or doesn't appear). I tried to put the tabs on the left and the buttons on the right via CSS but without success …

Regards
P.S. : I use kendo ASP.NET MVC 2021.1.224

6 Answers, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 24 Mar 2021, 03:20 PM

Hi Syleps,

Thank you for the details provided.

I tried to replicate the described faulty behavior. The result could be observed in the following dojo example that I prepared for the case:

The value of the dateTimePicker is not applying seconds. Could you please provide more details and a runnable, isolated, sample project? Examining this project will let us replicate the issue locally and further troubleshoot it.

Looking forward to hearing back from you.

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Syleps
Top achievements
Rank 1
Veteran
answered on 24 Mar 2021, 04:02 PM

Hi,

https://dojo.telerik.com/iRAlaxAH

I added the format "dd/MM/yyyy HH:mm:ss" in your example for the datetime pickers (this is the standard "G" format in France), and I also uninitialized the date to start from a "blank" date to better see the problem.

We see that the seconds are not in the popup window, but we have AM / PM; which is irrelevant given that we have the hours over 24 hours (and not 12).

Indeed, in classic mode we don't have any more seconds in the popup, but when we select in the list they are set to 0; which is not the case with modern.

I would have liked that:

- seconds are systematically at 0 (unless you choose "now")

- display the hours over 24 hours and the seconds instead of AM / PM (depending on the format)

Regards

0
Anton Mironov
Telerik team
answered on 29 Mar 2021, 01:37 PM

Hello Syleps,

Thank you for the additional details provided.

I can clearly see your point. I spoke with an expert from our developers' team and assume that the pointed behavior is expected. The Kendo UI DateTimePicker is taking care of the date and time without setting the seconds out of the box. 

In order to achieve the desired behavior, I would recommend manually set the seconds. Here is an example of the pointed approach that I created for the case:

I hope this information and implementation above will be a working solution for resolving the case.

 

Best Regards,
Anton Mironov
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
Syleps
Top achievements
Rank 1
Veteran
answered on 02 Apr 2021, 06:07 AM

Hi,

no, that's not what i need.

I don't want to initialize with the seconds at 0, I want to enter the seconds via the popup window (with "modern" type)

Ideally, the timer section of the datetimepicker would work like the timerpicker, with seconds. But, from what I understand, it's not possible

So what I need is when entering or modifying the time, the seconds are at 0.

I tried something like this but it doesn't work. It always takes the seconds of 'now'.

                    $("#datetimepicker_timeview").bind("click",
                        function() {
                          const item = $("#datetimepicker").data("kendoDateTimePicker");
                          var value = item.value(); 
                          if (value) {
                              value.setSeconds(0);
                              value.setMilliseconds(0);
                              item.value(value);
                          }
                        });

cf https://dojo.telerik.com/iRAlaxAH

My question is: is there a way to reset the seconds when we set/change the time on popup window? (like "classic" type)

Regards

0
Syleps
Top achievements
Rank 1
Veteran
answered on 02 Apr 2021, 06:26 AM

Hi,

In fact, forget my previous reply. I think found a solution : change the format of timeView :

$("#datetimepicker").data("kendoDateTimePicker").timeView.options.format = "HH:mm:ss"

My question is now : why the datetime picker doesn't put the right format (= like the timepicker)?

0
Anton Mironov
Telerik team
answered on 06 Apr 2021, 04:32 PM

Hi Syleps,

Thank you for sharing the working approach that you created. I am glad to hear that the first issue is now resolved.

The different pickers are represented by different widgets. Try to set the needed format manually for each picker and observe the result. If further assistance is needed, please provide a runnable project or dojo example and I will try my best to achieve the desired behavior for the needs of your application.

Looking forward to hearing back from you.

 

Greetings,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Date/Time Pickers
Asked by
Syleps
Top achievements
Rank 1
Veteran
Answers by
Anton Mironov
Telerik team
Syleps
Top achievements
Rank 1
Veteran
Share this question
or