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

Using datebox breaks DateJS #222

Closed chris-h-sg closed 11 years ago

chris-h-sg commented 12 years ago

I want to use datebox in a project that uses DateJS for general date handling.

As soon as I create the first datebox, DateJS's parse method stops working; from that point on it always returns the current day. Looking at the datebox code, this may be related to the custom extensions to Date's prototype in _enhanceDate().

As-is, it appears that datebox is not usable in a project together with DateJS.

chris-h-sg commented 12 years ago

I fixed this locally by renaming the set(), setWeek() and getWeek() methods datebox adds to Date.prototype. There appear to be no conflicts with the other methods.

jtsage commented 11 years ago

Yes, I have no doubt of that - it's a namespacing thing - I have to decide what to do about this, as it is a very much non-trivial fix.

chris-h-sg commented 11 years ago

Would it be possible to rename the conflicting methods in datebox, e.g. getDateboxWeek rather than getWeek?

We upgraded our project to JQM 1.3 recently and had to upgrade datebox as well. Manually renaming the methods still works, but it's a little error-prone having to remember it whenever updating datebox.

jtsage commented 11 years ago

It is possible, yes - but it will break all of the datebox modules - very much non-trivial. Those methods are there because parts of datebox rely on them. I will look at DateJS and see if maybe I can make my methods act identical, and not override if it detects datejs already loaded.

chris-h-sg commented 11 years ago

That's great, thank you!