Search schedule for specific country and date

@param country
@param date
@param callback
165216
function scheduleSearch( country, date, callback ) {
    var url = apiBaseUrl+endpoints['schedule'].replace('$1', country).replace('$2', date);

    fetch(url, function(result) {
        callback(result);
    });
}
803018
function cronToText(cronspec, sixth, locale = LOCALE) {
  var schedule = parseCron(cronspec, sixth);

  function absFloor(number) {
    if (number < 0) {
      return Math.ceil(number);
    } else {
      return Math.floor(number);
    }
  }

  function toInt(argumentForCoercion) {
    var coercedNumber = +argumentForCoercion,
      value = 0;

    if (coercedNumber !== 0 && isFinite(coercedNumber)) {
      value = absFloor(coercedNumber);
    }

    return value;
  }

  function ordinal(number) {
    var b = number % 10,
      output = (toInt(number % 100 / 10) === 1) ? locale.ORDINALS.th :
        (b === 1) ? locale.ORDINALS.st :
          (b === 2) ? locale.ORDINALS.nd :
            (b === 3) ? locale.ORDINALS.rd : locale.ORDINALS.th;
    return number + output;
  }

  /**
   * For an array of numbers, e.g. a list of hours in a schedule,
   * return a string listing out all of the values (complete with
   * "and" plus ordinal text on the last item).
   * @param {Number[]} numbers
   * @returns {string}
   */
  function numberList(numbers) {
    if (numbers.length < 2) {
      return ordinal(numbers);
    }

    var lastVal = numbers.pop();
    return numbers.join(', ') + ` ${locale['and']} ` + ordinal(lastVal);
  }

  /**
   * Parse a number into day of week, or a month name;
   * used in dateList below.
   * @param {Number|String} value
   * @param {String} type
   * @returns {String}
   */
  function numberToDateName(value, type) {
    if (type == 'dow') {
      return locale.DOW[value - 1];
    } else if (type == 'mon') {
      return locale.MONTH[value - 1];
    }
  }

  /**
   * From an array of numbers corresponding to dates (given in type: either
   * days of the week, or months), return a string listing all the values.
   * @param {Number[]} numbers
   * @param {String} type
   * @returns {String}
   */
  function dateList(numbers, type) {
    if (numbers.length < 2) {
      return numberToDateName('' + numbers[0], type);
    }

    var lastVal = '' + numbers.pop();
    var outputText = '';

    for (var i = 0, value; value = numbers[i]; i++) {
      if (outputText.length > 0) {
        outputText += ', ';
      }
      outputText += numberToDateName(value, type);
    }
    return outputText + ` ${locale['and']} ` + numberToDateName(lastVal, type);
  }

  /**
   * Pad to equivalent of sprintf('%02d').
   * @param {Number} x
   * @returns {string}
   */
  function zeroPad(x) {
    return (x < 10) ? '0' + x : x;
  }

  //----------------

  /**
   * Given a schedule, generate a friendly sentence description.
   * @param {Object} schedule
   * @returns {string}
   */
  function scheduleToSentence(schedule) {
    var outputText = locale.Every + ' ';

    if (schedule['h'] && schedule['m'] && schedule['h'].length <= 2 && schedule['m'].length <= 2) {
      // If there are only one or two specified values for
      // hour or minute, print them in HH:MM format

      var hm = [];
      for (var i = 0; i < schedule['h'].length; i++) {
        for (var j = 0; j < schedule['m'].length; j++) {
          hm.push(zeroPad(schedule['h'][i]) + ':' + zeroPad(schedule['m'][j]));
        }
      }
      if (hm.length < 2) {
        outputText = hm[0];
      } else {
        var lastVal = hm.pop();
        outputText = hm.join(', ') + ` ${locale.and} ` + lastVal;
      }
      if (!schedule['d'] && !schedule['D']) {
        outputText += ` ${locale['every day']}`;
      }
    } else {
      // Otherwise, list out every specified hour/minute value.

      if (schedule['h']) { // runs only at specific hours
        if (schedule['m']) { // and only at specific minutes
          outputText += numberList(schedule['m']) + ` ${locale['minute past the']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        } else { // specific hours, but every minute
          outputText += `${locale['minute of']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        }
      } else if (schedule['m']) { // every hour, but specific minutes
        outputText += numberList(schedule['m']) + ` ${locale['minute every hour']}`;
      } else { // cronspec has "*" for both hour and minute
        outputText += locale['minute'];
      }
    }

    if (schedule['D']) { // runs only on specific day(s) of month
      outputText += (locale['on the'] ? ` ${locale['on the']} ` : ' ') + numberList(schedule['D']);
      if (!schedule['M']) {
        outputText += ` ${locale['of every month']}`;
      }
    }

    if (schedule['d']) { // runs only on specific day(s) of week
      if (schedule['D']) {
        // if both day fields are specified, cron uses both; superuser.com/a/348372
        outputText += ` ${locale['and every']} `;
      } else {
        outputText += ` ${locale['on']} `;
      }
      outputText += dateList(schedule['d'], 'dow');
    }

    if (schedule['M']) {
      // runs only in specific months; put this output last
      outputText += ` ${locale['in']} ` + dateList(schedule['M'], 'mon');
    }

    return outputText;
  }

  return scheduleToSentence(schedule.schedules[0]);
}
942192
public void addCalendar (final String calName,
                           final ICalendar calendar,
                           final boolean replace,
                           final boolean updateTriggers) throws SchedulerException
  {
    validateState ();

    m_aResources.getJobStore ().storeCalendar (calName, calendar, replace, updateTriggers);
  }
940908
public final void setItsDate(final Date pItsDate) {
    if (pItsDate == null) {
      this.itsDate = null;
    } else {
      this.itsDate = new Date(pItsDate.getTime());
    }
  }
819299
public void setDate(com.google.api.ads.admanager.axis.v201805.Date date) {
        this.date = date;
    }
1317856
function (date) {
        var q = $q.defer();

        navigator.globalization.isDayLightSavingsTime(
          date,
          function (result) {
            q.resolve(result);
          },
          function (err) {
            q.reject(err);
          });
        return q.promise;
      }
1183162
public void onCountryCodeSelected(String country, String dialCode) {
        if (passwordlessRequestCodeLayout != null) {
            passwordlessRequestCodeLayout.onCountryCodeSelected(country, dialCode);
        }
    }
591610
function queryFunction(query) {
        var selectivity = query.selectivity;
        var term = query.term;
        var offset = query.offset || 0;
        var results;
        if (selectivity.el.getAttribute('id') === 'single-input-with-submenus') {
            if (selectivity.dropdown) {
                var timezone = selectivity.dropdown.highlightedResult.id;
                results = citiesWithTimezone
                    .filter(function(city) {
                        return (
                            transformText(city.id).indexOf(transformText(term)) > -1 &&
                            city.timezone === timezone
                        );
                    })
                    .map(function(city) {
                        return city.id;
                    });
            } else {
                query.callback({ more: false, results: [] });
                return;
            }
        } else {
            results = cities.filter(function(city) {
                return transformText(city).indexOf(transformText(term)) > -1;
            });
        }
        results.sort(function(a, b) {
            a = transformText(a);
            b = transformText(b);
            var startA = a.slice(0, term.length) === term,
                startB = b.slice(0, term.length) === term;
            if (startA) {
                return startB ? (a > b ? 1 : -1) : -1;
            } else {
                return startB ? 1 : a > b ? 1 : -1;
            }
        });
        setTimeout(function() {
            query.callback({
                more: results.length > offset + 10,
                results: results.slice(offset, offset + 10)
            });
        }, 500);
    }
149607
function (options, callback) {

			fs.stat(options.file_path, function (err, stats) {

				if (err) {
					callback(err);
				}
				else {
					var local_date = new Date(stats.mtime).getTime();
					var server_date = new Date(options.server_date).getTime();

					if (options.compare_date === 'newer') {
						callback(null, local_date > server_date);
					}
					else {
						callback(null, local_date < server_date);
					}
				}
			});
		}
823210
function(date) {
        if (this._calendar.name !== date._calendar.name) {
            throw (_exports.local.differentCalendars || _exports.regionalOptions[''].differentCalendars).
                replace(/\{0\}/, this._calendar.local.name).replace(/\{1\}/, date._calendar.local.name);
        }
        var c = (this._year !== date._year ? this._year - date._year :
            this._month !== date._month ? this.monthOfYear() - date.monthOfYear() :
            this._day - date._day);
        return (c === 0 ? 0 : (c < 0 ? -1 : +1));
    }
152354
function(target, date) {
		var inst = this._getInst(target);
		if (inst) {
			this._setDate(inst, date);
			this._updateDatepicker(inst);
			this._updateAlternate(inst);
		}
	}
310444
public void setDate(String date) {
        if (date == null || date.trim().isEmpty()) {
            throw new IllegalArgumentException("Date cannot be null or empty.");
        }
        try {
            Date dateToSet = new SimpleDateFormat("MM/dd/yyyy").parse(date);
            Calendar to = Calendar.getInstance();
            to.setTime(dateToSet);
            setDate(to);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
1332210
@Override
    public List<PhoneNumber> searchForNumbers(String country, PhoneNumberSearchFilters listFilters) {
        if(logger.isDebugEnabled()) {
            logger.debug("searchPattern " + listFilters.getFilterPattern());
        }
        String areaCode = listFilters.getAreaCode();
        Pattern filterPattern = listFilters.getFilterPattern();
        String searchPattern = null;
        if(filterPattern != null) {
            searchPattern = filterPattern.toString();
        }
        if ((areaCode == null || !areaCode.isEmpty() || areaCode.length() < 3) &&
                (searchPattern != null && !searchPattern.toString().isEmpty() && searchPattern.toString().length() >= 5)) {
            areaCode = searchPattern.toString().substring(2, 5);
            if(logger.isDebugEnabled()) {
                logger.debug("areaCode derived from searchPattern " + searchPattern);
            }
        }
        if (areaCode != null && !areaCode.isEmpty() && (areaCode.length() == 3)) {
            final StringBuilder buffer = new StringBuilder();
            buffer.append("<request id=\""+generateId()+"\">");
            buffer.append(header);
            buffer.append("<body>");
            buffer.append("<requesttype>").append("getDIDs").append("</requesttype>");
            buffer.append("<item>");
            buffer.append("<npa>").append(areaCode).append("</npa>");
            buffer.append("</item>");
            buffer.append("</body>");
            buffer.append("</request>");
            final String body = buffer.toString();
            final HttpPost post = new HttpPost(uri);

            List<NameValuePair> parameters = new ArrayList<NameValuePair>();
            parameters.add(new BasicNameValuePair("apidata", body));
            try {
                post.setEntity(new UrlEncodedFormEntity(parameters));

                final DefaultHttpClient client = new DefaultHttpClient();
                if (telestaxProxyEnabled) {
                    addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.GETDIDS.name());
                }
                final HttpResponse response = client.execute(post);
                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                    final String content = StringUtils.toString(response.getEntity().getContent());
                    final VoipInnovationsResponse result = (VoipInnovationsResponse) xstream.fromXML(content);
                    final GetDIDListResponse dids = (GetDIDListResponse) result.body().content();
                    if (dids.code() == 100) {
                        final List<PhoneNumber> numbers = toAvailablePhoneNumbers(dids, listFilters);
                        return numbers;
                    }
                } else {
                    logger.warn("Couldn't reach uri for getting DIDs. Response status was: "+response.getStatusLine().getStatusCode());
                }
            } catch (final Exception e) {
                logger.warn("Couldn't reach uri for getting DIDs " + uri, e);
            }
        }
        return new ArrayList<PhoneNumber>();
    }
192817
public void setDateFormatCalendar(Calendar calendar) {
        dateFormatter.setCalendar(calendar != null ? calendar : Calendar.getInstance());
    }
266424
function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
    if (resultSelector) {
        if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(resultSelector)) {
            scheduler = resultSelector;
        }
        else {
            return function () {
                var args = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    args[_i] = arguments[_i];
                }
                return bindNodeCallback(callbackFunc, scheduler).apply(void 0, args).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_4__["isArray"])(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
            };
        }
    }
    return function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var params = {
            subject: undefined,
            args: args,
            callbackFunc: callbackFunc,
            scheduler: scheduler,
            context: this,
        };
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
            var context = params.context;
            var subject = params.subject;
            if (!scheduler) {
                if (!subject) {
                    subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"]();
                    var handler = function () {
                        var innerArgs = [];
                        for (var _i = 0; _i < arguments.length; _i++) {
                            innerArgs[_i] = arguments[_i];
                        }
                        var err = innerArgs.shift();
                        if (err) {
                            subject.error(err);
                            return;
                        }
                        subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
                        subject.complete();
                    };
                    try {
                        callbackFunc.apply(context, args.concat([handler]));
                    }
                    catch (err) {
                        subject.error(err);
                    }
                }
                return subject.subscribe(subscriber);
            }
            else {
                return scheduler.schedule(dispatch, 0, { params: params, subscriber: subscriber, context: context });
            }
        });
    };
}
582944
public void setDate(Date date) {
		Date oldDate = calendar.getTime();
		calendar.setTime(date);
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH);
		int day = calendar.get(Calendar.DAY_OF_MONTH);

		yearChooser.setYear(year);
		monthChooser.setMonth(month);
		dayChooser.setCalendar(calendar);
		dayChooser.setDay(day);

		firePropertyChange("date", oldDate, date);
	}
997177
private Locale searchLocale(String language, String country,
                                String variant) {
        Locale[] locales = Locale.getAvailableLocales();
        for (int i = 0; i < locales.length; i++) {
            if (locales[i].getLanguage().equals(language) &&
               (country == null || locales[i].getCountry().equals(country)) &&
               (variant == null || locales[i].getVariant().equals(variant))) {
                return locales[i];
            }
        }
        return null;
    }