diff --git a/dist/rome.standalone.js b/dist/rome.standalone.js index a27667f..ef80004 100644 --- a/dist/rome.standalone.js +++ b/dist/rome.standalone.js @@ -356,6 +356,7 @@ function calendar (calendarOptions) { var lastMonth; var lastDay; var lastDayElement; + var lastTimeElement; var datewrapper; var back; var next; @@ -381,6 +382,7 @@ function calendar (calendarOptions) { lastYear = no; lastDay = no; lastDayElement = no; + lastTimeElement = no; o.appendTo.appendChild(container); removeChildren(container); @@ -954,6 +956,15 @@ function calendar (calendarOptions) { if (!classes.contains(target, o.styles.timeOption)) { return; } + if (!classes.contains(target, o.styles.selectedTime)) { + if (lastTimeElement) { + classes.remove(lastTimeElement, o.styles.selectedTime); + } + if(target){ + classes.add(target, o.styles.selectedTime); + } + lastTimeElement = target; + } var value = momentum.moment(text(target), o.timeFormat); setTime(ref, value); refCal = ref.clone(); diff --git a/src/calendar.js b/src/calendar.js index 2c1dff8..168dbf2 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -30,6 +30,7 @@ function calendar (calendarOptions) { var lastMonth; var lastDay; var lastDayElement; + var lastTimeElement; var datewrapper; var back; var next; @@ -55,6 +56,7 @@ function calendar (calendarOptions) { lastYear = no; lastDay = no; lastDayElement = no; + lastTimeElement = no; o.appendTo.appendChild(container); removeChildren(container); @@ -628,6 +630,15 @@ function calendar (calendarOptions) { if (!classes.contains(target, o.styles.timeOption)) { return; } + if (!classes.contains(target, o.styles.selectedTime)) { + if (lastTimeElement) { + classes.remove(lastTimeElement, o.styles.selectedTime); + } + if(target){ + classes.add(target, o.styles.selectedTime); + } + lastTimeElement = target; + } var value = momentum.moment(text(target), o.timeFormat); setTime(ref, value); refCal = ref.clone();