Search results

Time Range

TimePicker provides an option to select a time value within a specified range by using the min and max properties. The min value should always be lesser than the max value.

When the min and max properties are configured and the selected time value is out-of-range or invalid, then the model value will be set to out of range time value or null respectively with highlighted error class to indicates the time is out of range or invalid.

The value property depends on the min/max with respect to strictMode property. The following example allows you to select a time value within a range of 9:00 AM to 11:30 AM.

<ejs-timepicker id="timepicker" value="@ViewBag.value" min="@ViewBag.minVal" max="@ViewBag.maxVal"></ejs-timepicker>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling MVC for empty projects, visit

namespace EJ2CoreSampleBrowser.Controllers
    public partial class HomeController: Controller
        // GET: /<controller>/
        public IActionResult DefaultFunctionalities()
            ViewBag.minVal= new DateTime(2017,08,03, 09,00,00);
            ViewBag.maxVal = new DateTime(2017,08,03, 11,30,00);
            ViewBag.value =  new DateTime(2017,08,03, 11,00,00);
            return View();

If the value of min or max property is changed through code behind you have to update the value property to set within the range.