SHARE
TWEET

Untitled

erikasakiree Mar 24th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getDate(dateString /* YYYY-MM-DD */) {
  2.     var reservedDateTimeStrings = []; // Tavo tas PHP kodas.
  3.     var reservedDateTime = reservedDateTimeStrings.map(function (value) { return moment(value); });
  4.     var date = moment(dateString);
  5.     var filtered = [];
  6.     for (var _i = 0, reservedDateTime_1 = reservedDateTime; _i < reservedDateTime_1.length; _i++) {
  7.         var d = reservedDateTime_1[_i];
  8.         if (d.year() === date.year() && d.month() === date.month() && d.date() === date.date()) {
  9.             filtered.push(d);
  10.         }
  11.     }
  12.     if (filtered.length > 0) {
  13.         var timeArray = filtered.map(function (value) { return [value.format('HH:mm'), value.add(1, 'hour').format('HH:mm')]; });
  14.         $(function() {
  15.             $('#timepicker').timepicker({
  16.                 'timeFormat': 'H:i',
  17.                 'minTime': '11:00',
  18.                 'maxTime': '23:00',
  19.                 'step': '60',
  20.                 'userSelect': true,
  21.                 'disableTimeRanges': timeArray
  22.             })
  23.         })
  24.     }
  25.     else {
  26.         $(function() {
  27.             $('#timepicker').timepicker({
  28.                 'timeFormat': 'H:i',
  29.                 'minTime': '11:00',
  30.                 'maxTime': '23:00',
  31.                 'step': '60',
  32.                 'userSelect': true
  33.             })
  34.         })
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top