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

Range between two dates

2 Answers 432 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Esteban
Top achievements
Rank 1
Esteban asked on 01 Mar 2012, 11:49 PM
Hi,

How to make a
range between two dates in a grid?

Many Thanks,
Sakn


2 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 02 Mar 2012, 02:00 PM
Hi Esteban,

You can define a column with a template and call a JavaScript function that calculates the difference.
For example:
//Column definition
{
    title: "Difference",
    template: "#= calculateDates(firstDate, secondDate) # days"
}
function calculateDates(first, second) {
    var diff = Math.round((second - first)/1000/60/60/24); //Difference in days
    return diff;
}

I hope this information helps. In the attachments you can find a sample project showing this approach in action.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Esteban
Top achievements
Rank 1
answered on 03 Mar 2012, 04:25 PM
Thank you for the answer
Tags
Grid
Asked by
Esteban
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Esteban
Top achievements
Rank 1
Share this question
or