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

Make datebox compatible with 1.1.0 #177

Closed tcha-tcho closed 12 years ago

tcha-tcho commented 12 years ago

Hello,

Jquery Mobile is now compatible with jQuery 1.7.1. Datebox stop working here.

I gonna try to create a list of issues related to this upgrade.

Thanks

nwhite89 commented 12 years ago

It's still the unstable version with 1.7.1 I believe; its the 1.1.0 Release Candidate which means it is still an unstable version ... (I may be wrong but I have been looking at upgrading my current project and that is what I can gather from the blog post about 1.1.0 RC)

tcha-tcho commented 12 years ago

It is still a release candidate. But I think we have the final characteristics of the new line of JM that will run from now on. Without the update the DateBox will lose compatibility in the future. It seems a good point to start work on a adaptation. What do you think?

nwhite89 commented 12 years ago

Oh don't get me wrong I'm not disagreeing with you and think your right good point to start from just wanted to ensure that you knew that is all :)

jtsage commented 12 years ago

Of course - and it actually is already started. https://github.com/jtsage/jquery-mobile-datebox/commits/datebox2 This represents a major branch too, as I am re-wireing how I handle each mode - the new method will allow you to include only those modes you plan to use, which should speed things up, and more importantly, shrink the code base. Right now, even minimized, datebox weighs in at around 55k - quite large for a plugin.

tcha-tcho commented 12 years ago

Great news Mr. Sage! I gonna start from there! Thank You!

As the issue is already addressed, do you think best close it for now? Or we leave it opened until the work is done?

jtsage commented 12 years ago

I think leave it open for a while. I am pretty much through the calbox mode, but I've yet to even start the others - this version also should be much kinder on the DOM - less crap left laying around if I'm doing it right.

Not true unit tests, but it's in the spirit of the thing: http://dev.jtsage.com/jQM-DateBox2/unit/calbox.html

jtsage commented 12 years ago

Also: http://dev.jtsage.com/jQM-DateBox2/unit/timebox.html and http://dev.jtsage.com/jQM-DateBox2/unit/datebox.html

tcha-tcho commented 12 years ago

Great Mr. Sage! I'm getting NaN here with this other links... I gonna fork your branch now. Do you think I could help in something in particular?

jtsage commented 12 years ago

Actualy, if you want to do a bit of exploring - looking for a clever way to implement time restrictions on timebox (and eventually timeflipbox, once I port that over). At a glance, i'd like a minHour, maxHour, and maybe something like: validHours: [0,1,10,11,22]

tcha-tcho commented 12 years ago

Ok! this weekend I will work exclusively in your code. As soon as I finish reading and understanding everything I hope to send you some patches for your evaluation. You can contact me anytime if you think I can be useful elsewhere in the code. So give it more attention.

Have a great weekend :)

tcha-tcho commented 12 years ago

Hi, sorry my delay.. A lot of my external codes broke after 1.7.1 :(

Took a look at datebox inside ... Some parts are really smart! I loved it! I'm still a little lost but I hope to find my self soon :) I was not able to find the piece of code that you spoke about. So I'll paste a quick suggestion below:

function is_valid(h) {
  return !isNaN(Date.parse('1-1-2010 '+(isNaN(h)?(parseInt(h)+(/(p|a)/ig.test(h)?12:0)):h)+':00'));
}

console.log('invalids--------------------')
console.log(is_valid(25))
console.log(is_valid(35))
console.log(is_valid(-3))
console.log(is_valid(107))
console.log(is_valid(0.5))
console.log(is_valid(24))
console.log(is_valid('30p'))
console.log(is_valid('25pm'))
console.log(is_valid('23pm'))
console.log(is_valid('14pm'))
console.log(is_valid('15a'))
console.log(is_valid('17a'))
console.log(is_valid('12am'))

console.log('valids----------------------')
console.log(is_valid('0pm'))
console.log(is_valid('02pm'))
console.log(is_valid('00am'))
console.log(is_valid('00a'))
console.log(is_valid('10p'))
console.log(is_valid(23))
console.log(is_valid(13))
console.log(is_valid(10))
console.log(is_valid(16))
console.log(is_valid(0))

Following this same idea this function could be used to test minutes and so on.

See you soon!