Retrieves the left and top offset of an object using Javascript. I got this from Peter-Paul Koch. His description is more extensive. [click to continue…]
{ 3 comments }
Retrieves the left and top offset of an object using Javascript. I got this from Peter-Paul Koch. His description is more extensive. [click to continue…]
{ 3 comments }
HTML of a Dropdown list with all the time zones already added. [click to continue…]
{ 17 comments }
Detecting DST should be a basic function that’s included in Javascript. Sadly, along with many other basic functions, this one isn’t. For all my Google searches I wasn’t able to find a clear cut bullet proof DST detector. Many only worked in one hemisphere or specific timezones. I wrote this function to be bullet proof. It will detect the correct time zone no matter what. [click to continue…]
{ 4 comments }
When I needed a way to detect the browser time zone all I found were posts using getTimezoneOffset. The problem with that was it never took into account Daylight Saving Time (DST). If the user was currently in DST the function returns the time zone plus 60 minutes. Those extra minutes pushed the user into the next time zone incorrectly. There was no way to know if getTimezoneOffset included DST or not.
My solution was to go through each month of the current year and find its offset. Since DST adds an hour to the offset I just needed to keep the lowest offset of the year. [click to continue…]
{ 5 comments }