Skip to content

Instantly share code, notes, and snippets.

@RobertCalise
Created March 21, 2017 16:11
Show Gist options
  • Save RobertCalise/24715acfc82b1943fa27ae513c4bf654 to your computer and use it in GitHub Desktop.
Save RobertCalise/24715acfc82b1943fa27ae513c4bf654 to your computer and use it in GitHub Desktop.
Fill Infusionsoft Timezone Field
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
var tz = jstz.determine().name(),
selected = jQuery('#Contact0TimeZone option[value="' + tz + '"]').prop('selected', true).val();
if(selected === undefined) {
/* If no match found, default to America/New_York as a fallback */
jQuery('#Contact0TimeZone option[value="America/New_York"]').prop('selected', true);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment