summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/calendar.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/content/widgets/calendar.js')
-rw-r--r--toolkit/content/widgets/calendar.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/toolkit/content/widgets/calendar.js b/toolkit/content/widgets/calendar.js
index 72e0d9d61..80c2976e0 100644
--- a/toolkit/content/widgets/calendar.js
+++ b/toolkit/content/widgets/calendar.js
@@ -54,23 +54,21 @@ function Calendar(options, context) {
* {
* {Number} textContent
* {Array<String>} classNames
+ * {Boolean} enabled
* }
* {Function} getDayString: Transform day number to string
* {Function} getWeekHeaderString: Transform day of week number to string
- * {Function} setValue: Set value for dateKeeper
- * {Number} selectionValue: The selection date value
+ * {Function} setSelection: Set selection for dateKeeper
* }
*/
setProps(props) {
if (props.isVisible) {
// Transform the days and weekHeaders array for rendering
- const days = props.days.map(({ dateValue, textContent, classNames }) => {
+ const days = props.days.map(({ dateObj, classNames, enabled }) => {
return {
- dateValue,
- textContent: props.getDayString(textContent),
- className: dateValue == props.selectionValue ?
- classNames.concat("selection").join(" ") :
- classNames.join(" ")
+ textContent: props.getDayString(dateObj.getUTCDate()),
+ className: classNames.join(" "),
+ enabled
};
});
const weekHeaders = props.weekHeaders.map(({ textContent, classNames }) => {
@@ -152,10 +150,10 @@ function Calendar(options, context) {
case "click": {
if (event.target.parentNode == this.context.daysView) {
let targetId = event.target.dataset.id;
- this.props.setValue({
- selectionValue: this.props.days[targetId].dateValue,
- dateValue: this.props.days[targetId].dateValue
- });
+ let targetObj = this.props.days[targetId];
+ if (targetObj.enabled) {
+ this.props.setSelection(targetObj.dateObj);
+ }
}
break;
}