@Html.EJS().DateRangePicker("dateRange").Format("yyyy-MM-dd hh:mm:ss").Presets(PresetItem =>
{
PresetItem.Label("Last Hour").Start(ViewBag.lastHourStart).End(ViewBag.lastHourEnd).Add();
PresetItem.Label("Last Day").Start(ViewBag.lastDayStart).End(ViewBag.lastDayEnd).Add();
PresetItem.Label("This Week").Start(ViewBag.weekStart).End(ViewBag.weekEnd).Add();
PresetItem.Label("This Month").Start(ViewBag.monthStart).End(ViewBag.monthEnd).Add();
PresetItem.Label("Last Month").Start(ViewBag.lastMonthStart).End(ViewBag.lastMonthEnd).Add();
PresetItem.Label("Last Year").Start(ViewBag.lastYearStart).End(ViewBag.lastYearEnd).Add();
}
).Placeholder("Select a Range").Width("310px").StartDate(ViewBag.frmDate).EndDate(ViewBag.toDate).Change("WeeklyChange").Render()
var WeeklyChange = function (args) {
if ((args.event) && (args.event.target.classList.contains("e-apply")))
{
var startDate = new Date(args.startDate.getTime() - (args.startDate.getTimezoneOffset() * 60000)).toISOString();
var endDate = new Date(args.endDate.getTime() - (args.endDate.getTimezoneOffset() * 60000)).toISOString();
var gridObj = document.getElementById("gridLog").ej2_instances[0];
gridObj.query = new ej.data.Query().addParams('fromDate', startDate).addParams('toDate', endDate) // send the query to server
stTime = performance.now();
gridObj.refresh();
var msgEle = document.getElementById('msg');
var val = (performance.now() - stTime).toFixed(0);
msgEle.innerHTML = 'Load Time: ' + "<b>" + val + "</b>" + '<b>ms</b>';
msgEle.classList.remove('e-hide');
}