Skip to content

Instantly share code, notes, and snippets.

@abl
Created September 10, 2013 16:48
Show Gist options
  • Save abl/6512197 to your computer and use it in GitHub Desktop.
Save abl/6512197 to your computer and use it in GitHub Desktop.
//This is completely ridiculous.
var jan = new Date(this.getFullYear(), 0, 1).getTimezoneOffset();
var jul = new Date(this.getFullYear(), 6, 1).getTimezoneOffset();
var today = new Date().getTimezoneOffset();
if(jan == jul) {
$('#daylight_savings').prop('checked', false);
} else if(jan > jun) {
//Northern hemisphere
$('#daylight_savings').prop('checked', (jun==today));
} else { //jun < jan
//Southern hemisphere
$('#daylight_savings').prop('checked', (jan==today));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment