Is any jQuery time plugin available for timing on an ASP.NET MVC page?

I have an ASP.NET page where the user needs to select TimeSlot, for example, 10:00 AM PST, 10:15 AM PST .... etc. with a constant interval of 15 minutes (flexible).

Using the jQuery datpicker, we can only select the date.

I am wondering if the jQuery plugin is available for Timeslots?

Rate your answers.

+3
source share
3 answers

jquery-timepicker is decent - I used this plugin for a recent project.

+4
source

The jQuery user interface has a pretty good option.

. .

DataPicker

+2

jQuery Validator jQuery TimePicker, , .

, ,

, , , .

jQuery

// custom rule for time fields
jQuery.validator.addMethod("time", function(value, element) {
    var hh = value.toString().substring(0, 2);
    var mm = value.toString().substr(3, 2);
    return this.optional(element) || ((parseFloat(hh) > 0 && parseFloat(hh) <= 12) && (parseFloat(mm) > 0 && parseFloat(mm) <= 59));
}, "Please enter a valid time");

EDIT: 00, 15, 30, 45

$(".time").blur(function() {
    var value = $(this).val();
    var hh = value.toString().substring(0, 2)
    var mm = parseFloat(value.toString().substr(3, 2));

    if (mm > 0 && mm <= 15) { $(this).val(hh+":15"); return; }
    if (mm > 15 && mm <= 30) { $(this).val(hh+":30"); return; }
    if (mm > 30 && mm <= 59) { $(this).val(hh+":45"); return; }

   $(this).val(hh+":45"); // if 00
});
+1

Source: https://habr.com/ru/post/1745010/


All Articles