Live data from Hacker News

Pickadate.js

github.com

71–80 of 130 posts

Re: Pickadate.js

#74
post #60

>6k and a jQuery dependency? Dates aren't as hard as they used to be. I'm working on a pure-JS datepicker for modern browsers that will clock in at under 5k minified, with no dependencies. Take a look at my work so far here: https://github.com/potch/fortnight.js (Edited to correct that the likely final minified size will be closer to 5k. Hoping to add accessibility features and localizability.)

I have always wondered why javascript date pickers were always over complicated for the job. https://github.com/listenrightmeow/daterange Under 5k/100 lines uncompressed. You can easily modify above to work in a prototype fashion without a library. Unfortunately I was lazy when I wrote it and used ender/jquery for selector support.

If you are going to offer something you claim to be better, it should be better. I did a "git clone" and opened the example:

* The example looks unappealing. Not styled, not bound to a text field.

* It's not clear to my why clicking twice in a row produces a range — should this not be accomplished through mouse dragging or similar?

* If I select an end date that precedes the start date, it shows an alert box, which apparently is hardwired into the library. Not only does this make it impossible to translate the widget into multiple languages, but it's really not the task of the library to handle the error like this (an "onInvalidRange" or similar should be provided for the app to plug in).

* Month name is hardwired, no translation possible.

* No week numbers.

* No highlighting of today, holidays, or indeed of the selected range.

* No way to plug in custom dates that should be highlighted (for example, "booked" dates).

In other words, this is incomplete. I can't speak for most people, but it's useless to me. Sure, I could take your code and extend it to fit my app, but I could just as easily write it from scratch -- which defeats the point of reusability.

Sorry if this comes across a bit harsh, but you did open yourself to criticism:

> I have always wondered why javascript date pickers were always over complicated for the job.

Frankly, I suspect you have underestimated the job. :-)

Re: Pickadate.js

#75
post #69

Earlier quoted context omitted.

Freezes up Chrome 23, Firefox 16.0.2 (shows "stop this script?" box) and Safari 6.0. Opera does not freeze, but the UI is very slow, suggesting something is still wrong.

I believe I made a huge mistake in my calendar rendering code. Hoping it's fixed now. Sorry for freezing!

It's still happening. Now (unlike before) it does show the widgets, but Chrome goes up to 100% CPU and nothing happens when I click the widgets.

Re: Pickadate.js

#76
post #69

Earlier quoted context omitted.

I believe I made a huge mistake in my calendar rendering code. Hoping it's fixed now. Sorry for freezing!

It's still happening. Now (unlike before) it does show the widgets, but Chrome goes up to 100% CPU and nothing happens when I click the widgets.

I can't reproduce- what version of chrome are you using? I'm re-evaluating all my loops to increase general safety.

Re: Pickadate.js

#77
post #29
post #24

Earlier quoted context omitted.

The lack of semicolons and the use of jshint bothers me.

The fact that the code is very neat and is well documented bothers me. Also the fact that javascript is a lot more readable when you put a blank line between every two lines bothers me (a lot!). And that it works perfectly and looks great, man that bothers me.

    // If datePassed is true
    else if ( datePassed === true ) {
Yes, very well documented. >.>

Re: Pickadate.js

#78
post #56

https://github.com/amsul/pickadate.js/blob/gh-pages/pickadat... the code is a giant var statement. I don't know why, but somehow that bothers me.

Yea, I'm not a fan of this pattern, it's a pain to step through with a debugger.

Sometimes I feel like the JS community is more concerned with "style" than practicality. I always do one variable per var, so much more readable and much easier to debug.

Re: Pickadate.js

#80
post #60

>6k and a jQuery dependency? Dates aren't as hard as they used to be. I'm working on a pure-JS datepicker for modern browsers that will clock in at under 5k minified, with no dependencies. Take a look at my work so far here: https://github.com/potch/fortnight.js (Edited to correct that the likely final minified size will be closer to 5k. Hoping to add accessibility features and localizability.)

Looks like Chrome's native date pickers are competing with fortnight. When I click on one of the input fields, while holding the click in, I get a fortnight picker. As soon as I let go, I get a native picker.
Post reply on HN