Does December work? :3
That was my first question too! So I tested it and it comes with December. Actually, it has all of the 12 months - no sacrifices there. Amazing stuff.
Pickadate.js
121–130 of 130 posts
Re: Pickadate.js
#122Re: Pickadate.js
#123From the demos it appears that this doesn't have keyboard support. That seems like a major drawback from an accessibility standpoint. It does look nice and easy otherwise, though.
I thought that when I use it as a textbox it would automatically auto complete and hint a month, or dynamically show calendar selecting date while I'm typing, it did neither of those things. Also I haven't looked at the API that hard, but from the examples it looks like it only supports american way of setting the date i.e. DD/Month/YYYY Update: another big omission, I can select year only by scrolling through it mon…
Re: Pickadate.js
#124Earlier quoted context omitted.
These pair nicely: http://dojotoolkit.org/reference-guide/1.8/dijit/form/DateTe...
I'm still completely baffled that Dojo doesn't seem to get as much love as it should.
Re: Pickadate.js
#125A few random comments... This value is not what it says: SECONDS_IN_DAY = 86400000, That's the number of milliseconds in a day. Instead of a magic precalculated number, why not create all the relevant constants so the values become perfectly clear: HOURS_IN_DAY = 24, MINUTES_IN_DAY = HOURS_IN_DAY * 60, SECONDS_IN_DAY = MINUTES_IN_DAY * 60, MILLISECONDS_IN_DAY = SECONDS_IN_DAY * 1000, Personally, I find these kinds of…
The problem here, of course, is that it makes the code a lot harder to understand. To understand and verify the function, I'd start by writing out a table of the days in each month while reciting the "30 days hath September" rhyme. :-) Then I'd have to go through all the the flip and non-flip cases in the code and compare against my table.
Let's imagine that JavaScript didn't have convenient date calculations so we couldn't use the updated function I posted above. If that were the case, what would be a simpler way to code the function? Just use the table of months directly. After all, there are only 12 months to deal with, so it's very simple:
getCountDays: function( year, month ) {
var monthDays = [
31, 0, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
];
return monthDays[month] || getFebDays( year );
},
where getFebDays() handles all the special cases for leap years ( /4, /100, /400, etc.)Now, with the exception of February, it's trivial to see at a glance if the function is correct.
Re: Pickadate.js
#126Earlier quoted context omitted.
Please, never use the Dojo Toolkit. I was forced to use it on a project and working with it was reinventing the wheel while pulling out hair. It was overly complicated for something that needed to be straightforward and simple.
Amen to that. The doc for it sucks too (not that there's enough there, but most doc for it found by google et al is obsolete/deprecated. And last but not least... the plugin ecosystem for dojo sucks even worse, and whatever widgets/dijits actually exist for it, usually look like @ss. The only one who seems to be committed to dojo is...IBM.
Re: Pickadate.js
#127Earlier quoted context omitted.
There you go - this will make your life easier then: http://dojotoolkit.org/reference-guide/1.8/dijit/form.html#d...
Too bulky in my opinion. I don't need 90 percent of the things in that sdk.
Now with Dojo AMD (1.7+) it's even better and cleaner. You only require what you need and then build.
Re: Pickadate.js
#128A few random comments... This value is not what it says: SECONDS_IN_DAY = 86400000, That's the number of milliseconds in a day. Instead of a magic precalculated number, why not create all the relevant constants so the values become perfectly clear: HOURS_IN_DAY = 24, MINUTES_IN_DAY = HOURS_IN_DAY * 60, SECONDS_IN_DAY = MINUTES_IN_DAY * 60, MILLISECONDS_IN_DAY = SECONDS_IN_DAY * 1000, Personally, I find these kinds of…
getCountDays( 2012, 2 ) // Daylight time began March 11
30 // oops
new Date(year,month,...) uses local time, so the day will be an hour longer or shorter when the time changes.A quick and dirty fix would be to use Math.round instead of Math.floor:
getCountDays = function( year, month ) {
var msInMonth = new Date(year,month+1) - new Date(year,month);
return Math.round( msInMonth / MILLISECONDS_IN_DAY );
},
And maybe better to use UTC? (I'd stick with Math.round at the same time.) getCountDays = function( year, month ) {
var msInMonth = Date.UTC(year,month+1) - Date.UTC(year,month);
return Math.round( msInMonth / MILLISECONDS_IN_DAY );
},Re: Pickadate.js
#129Earlier quoted context omitted.
But how can you tell if the browser has support for the native picker? You can't. That's what I was wondering. If there were a way, it'd be pretty awesome to use a library like this as a polyfill rather than as a separate thing you attach to text inputs.
You can. Modernizr will tell you if the browser supports the native picker. http://modernizr.com/
[0]: https://github.com/Modernizr/Modernizr/wiki/Undetectables