Skip to content

Commit f58ce4a

Browse files
committed
Clean up datepicker strings
1 parent 3e619b8 commit f58ce4a

File tree

1 file changed

+19
-61
lines changed

1 file changed

+19
-61
lines changed

js/datepicker.js

+19-61
Original file line numberDiff line numberDiff line change
@@ -359,22 +359,13 @@
359359
year: date.getFullYear()
360360
}
361361
];
362-
// if (this.options.mainCalendar === 'right') {
363-
// this.calendars[0].month += 1 - this.options.numberOfMonths;
364-
// }
365362
}
366363

367364
this.adjustCalendars();
368365
}
369366

370367
adjustCalendars() {
371368
this.calendars[0] = this.adjustCalendar(this.calendars[0]);
372-
// for (let c = 1; c < this.options.numberOfMonths; c++) {
373-
// this.calendars[c] = this.adjustCalendar({
374-
// month: this.calendars[0].month + c,
375-
// year: this.calendars[0].year
376-
// });
377-
// }
378369
this.draw();
379370
}
380371

@@ -521,23 +512,10 @@
521512
arr.push('is-endrange');
522513
}
523514
return (
524-
'<td data-day="' +
525-
opts.day +
526-
'" class="' +
527-
arr.join(' ') +
528-
'" aria-selected="' +
529-
ariaSelected +
530-
'">' +
531-
'<button class="datepicker-day-button" type="button" ' +
532-
'data-year="' +
533-
opts.year +
534-
'" data-month="' +
535-
opts.month +
536-
'" data-day="' +
537-
opts.day +
538-
'">' +
539-
opts.day +
540-
'</button>' +
515+
`<td data-day="${opts.day}" class="${arr.join(' ')}" aria-selected="${ariaSelected}">` +
516+
`<button class="datepicker-day-button" type="button" data-year="${opts.year}" data-month="${
517+
opts.month
518+
}" data-day="${opts.day}">${opts.day}</button>` +
541519
'</td>'
542520
);
543521
}
@@ -568,11 +546,11 @@
568546
arr = [];
569547
for (i = 0; i < 7; i++) {
570548
arr.push(
571-
'<th scope="col"><abbr title="' +
572-
this.renderDayName(opts, i) +
573-
'">' +
574-
this.renderDayName(opts, i, true) +
575-
'</abbr></th>'
549+
`<th scope="col"><abbr title="${this.renderDayName(opts, i)}">${this.renderDayName(
550+
opts,
551+
i,
552+
true
553+
)}</abbr></th>`
576554
);
577555
}
578556
return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>';
@@ -628,31 +606,19 @@
628606

629607
for (arr = []; i < j && i <= opts.maxYear; i++) {
630608
if (i >= opts.minYear) {
631-
arr.push(
632-
'<option value="' +
633-
i +
634-
'"' +
635-
(i === year ? ' selected="selected"' : '') +
636-
'>' +
637-
i +
638-
'</option>'
639-
);
609+
arr.push(`<option value="${i}" ${i === year ? 'selected="selected"' : ''}>${i}</option>`);
640610
}
641611
}
642612

643-
yearHtml =
644-
'<select class="datepicker-select orig-select-year" tabindex="-1">' +
645-
arr.join('') +
646-
'</select>';
613+
yearHtml = `<select class="datepicker-select orig-select-year" tabindex="-1">${arr.join(
614+
''
615+
)}</select>`;
647616

648617
let leftArrow =
649618
'<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>';
650-
html +=
651-
'<button class="month-prev' +
652-
(prev ? '' : ' is-disabled') +
653-
'" type="button">' +
654-
leftArrow +
655-
'</button>';
619+
html += `<button class="month-prev${
620+
prev ? '' : ' is-disabled'
621+
}" type="button">${leftArrow}</button>`;
656622

657623
html += '<div class="selects-container">';
658624
if (opts.showMonthAfterYear) {
@@ -670,16 +636,11 @@
670636
next = false;
671637
}
672638

673-
// if (c === (this.options.numberOfMonths - 1) ) {
674639
let rightArrow =
675640
'<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg>';
676-
html +=
677-
'<button class="month-next' +
678-
(next ? '' : ' is-disabled') +
679-
'" type="button">' +
680-
rightArrow +
681-
'</button>';
682-
// }
641+
html += `<button class="month-next${
642+
next ? '' : ' is-disabled'
643+
}" type="button">${rightArrow}</button>`;
683644

684645
return (html += '</div>');
685646
}
@@ -933,9 +894,6 @@
933894
if (Datepicker._isDate(date)) {
934895
this.setDate(date);
935896
}
936-
// if (!self._v) {
937-
// self.show();
938-
// }
939897
}
940898

941899
renderDayName(opts, day, abbr) {

0 commit comments

Comments
 (0)