Example #1
0
    function selectDateInDatePicker(newDate) {
      var date = DateFormatting.parse(newDate, DateFieldInput.DATE_FORMAT);
      var selectorForDate = '.pika-day' +
        '[data-pika-year="' + date.getFullYear() + '"]' +
        '[data-pika-month="' + date.getMonth() + '"]' +
        '[data-pika-day="' + date.getDate() + '"]';

      var correspondingDate = datePicker.querySelector(selectorForDate);
      correspondingDate.dispatchEvent(new Event('mousedown'));
    }
Example #2
0
 assert.throws(function runWithoutTheSecondArgument() {
   DateFormatting.parse('2015-06-07');
 },
Example #3
0
 assert.throws(function runWithEmptyStringAsFirstArgument() {
   DateFormatting.parse('');
 },
Example #4
0
 assert.throws(function runWithoutTheFirstArgument() {
   DateFormatting.parse();
 },
Example #5
0
 before(function() {
   date = DateFormatting.parse('2015-06-07', 'YYYY-MM-DD');
 });
Example #6
0
    function nextDay(initialFormattedDate) {
      var initialDate = DateFormatting.parse(initialFormattedDate, DateFieldInput.DATE_FORMAT);
      var nextDate = new Date(initialDate.getFullYear(), initialDate.getMonth(), initialDate.getDate() + 1);

      return DateFormatting.format(nextDate, DateFieldInput.DATE_FORMAT);
    }
Example #7
0
 this.getDate = function() {
   var text = input.getValue();
   return text ? DateFormatting.parse(text, DateFieldInput.DATE_FORMAT) : new Date();
 };