jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

calbox - jqm - themeDateToday not respected after setTheDate #431

Closed ggiordan closed 5 years ago

ggiordan commented 6 years ago

It seems if you initialize the box with the current date either programatically or on declaration, the current date element always gets theme 'b'.

In my case: theme a, has black buttons and theme b has white buttons. So by default, I'll get a calendar with all black days, with 'today' being white. I'm trying to get it to do the reverse. So, I declare the calbox as follows:

<input type="text" id="mydate" data-role="datebox" data-options='{"mode": "calbox", "closeCallback": "dateSelected", "themeDate": "b", "themeDateToday": "a", "showInitialValue": "true" }' />

This results in all the day elements getting theme 'b'. But, if I declare as follows, I get the expected result ('today' gets theme a)

<input type="text" id="mydate" data-role="datebox" data-options='{"mode": "calbox", "closeCallback": "dateSelected", "themeDate": "b", "themeDateToday": "a"}' />

I've also tried to do it programatially with the same result:

   $("#mydate").datebox('setTheDate', new Intl.DateTimeFormat("en", { day: '2-digit', month: '2-digit', year: 'numeric' }).format(new Date()));  // if this line is executed, 'today' gets theme b, no matter what I seem to do
   $("#mydate").datebox({themeDate:"b",themeDateToday:"a"});
jtsage commented 5 years ago

Hmm. sorry for the incrdibly long wait on this.

At a glance, the theme code in calbox on v4 is a mess. A hot mess. This will be fixed in v5, it's a complete re-write of pretty much everything, and I've not yet seen any of these little oddities pop up.

(Namely, it has a clearly defined theme hierarchy, which helps tremendously.)