Date in TZ using QPTools

Given a date and an offset return a new date

by bladnman

HTML

<script src="http://qubedpeas.com/files/currentVersion/QPTools.js"></script>
<div id="log" class="log"></div>

CSS

.runButton {
    width:   125px;
    margin:  20px;
}
.log {
   padding:10px; 
    margin: 20px; 
    border: 1px dotted #ccc; 
    color:#888; 
    font-face: arial; 
    font-size:12px; 
    background: #fbfbfb; 
}

JavaScript

/* ************************************ */
function runTest() {
    log("(0) UTC", QPU.dateInTZ(0));
    log("(1) London", QPU.dateInTZ(1));
    log("(5:45) Nepal", QPU.dateInTZ(5.75));
    log("(-5) New York", QPU.dateInTZ(-5));    
    log("(-5.5) New York+", QPU.dateInTZ(-5.5));
    log("(-8) San Francisco", QPU.dateInTZ(-8));
    log("(-10) Hawaii", QPU.dateInTZ(-10));
}

runTest();




/* ************************************ 
 _____ ___ __  __ ___ _      _ _____ ___ 
|_   _| __|  \/  | _ \ |    /_\_   _| __|
  | | | _|| |\/| |  _/ |__ / _ \| | | _| 
  |_| |___|_|  |_|_| |____/_/ \_\_| |___|
                                         
************************************  */
function log(message, value) {
    var outMessage = message;

    if (typeof value !== "undefined" && value !== null) {
        outMessage += "&nbsp;&nbsp;&nbsp;&nbsp;[" + value + "]";
    }
    if ($("#log").html() != "") {
        $("#log").append("<br>");
    }
    $("#log").append(outMessage);

    if (window.console && console.log) {
        console.log(outMessage);
    }
}
$("#theButton").live('click', function() {
    runTest();
});