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

Time to now using Kendo UI

1 Answer 35 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anatoli
Top achievements
Rank 1
Anatoli asked on 19 Jan 2016, 08:34 AM

I want to be able to convert Date into a "Time from now" format. I can accomplish the same using Moment.js library, but if I achieve the same using Kendo UI, I see no point in using Moment.js  

http://jsbin.com/bufikakufu/2/edit?html,output

What's the simplest way to get this done using Kendo. I don't want to get into manually parsing date object, and then diffing the date from now etc.. 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 20 Jan 2016, 09:50 AM
Hi Purna,

In Kendo UI there is no method that will calculate the difference between two dates and you will have to use either a custom library or the following simple JavaScript that will calculate the days between two dates:
var today = new Date());
var selected = $("#datePicker").data("kendoDatePicker").value();
  
var diff = Math.round((selected - today)/1000/60/60/24); //Difference in days


Best Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Anatoli
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or