Archive of January 2010
Quick date validation with a Regular Expression
Here's the breakdown of what it does:
Given a date format of YYYY-MM-DD (standard MySQL date format and easiest format for sorting) it makes sure that
- the year is numeric and starts with 20 or 19, and
- the month is numeric and is either
- between 01 - 12 and followed by a numeric day value between 01-28;
- between 01 - 12 but not 02 and followed by a day value of 29 or 30; or
- one of 01,03,05,07,08,10,12 and followed by a day value of 31
I have left out Feb. 29th so that you are forced to do a secondary leap year check.
WebKit diplay bug when switching position from absolute to fixed
Found an interesting WebKit bug that affects both Safari and Google Chrome. Changing an element from absolute positioning with bottom set to a value to fixed (with a bottom value) causes it's positioning to be relative to the top of the window frame. That is if an element has a position of absolute and a bottom of -50px and is switched to postion fixed, all but the bottom 50px will appear at the top of the page, instead of the bottom where it should be. For the switch to work properly, there must be a point in time where no position is set between the two states.
I've created a test page to illustrate this bug.