Fix the check for a non value in the time update for original timezone.
This commit is contained in:
parent
122f33fbd6
commit
1ff7d4080c
@ -4,3 +4,6 @@ span p{
|
||||
select {
|
||||
max-width: 95%;
|
||||
}
|
||||
.chkbox {
|
||||
display: inline-block;
|
||||
}
|
||||
|
4
clock.js
4
clock.js
@ -34,7 +34,7 @@ function startTime(){
|
||||
hour:'2-digit',
|
||||
minute:'2-digit',
|
||||
second:'2-digit',});
|
||||
if(original_tz != null){
|
||||
if(original_tz){//Test if there is a non-null value for original_tz. If True then the part of the page this pertains to is being displayed.
|
||||
document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{
|
||||
timeZone: original_tz,
|
||||
dateStyle:'long',
|
||||
@ -47,5 +47,5 @@ function startTime(){
|
||||
minute:'2-digit',
|
||||
second:'2-digit'});
|
||||
}
|
||||
document.getElementById('JStz').innerHTML = current_tz;
|
||||
//document.getElementById('JStz').innerHTML = current_tz;
|
||||
}
|
||||
|
10
clock.php
10
clock.php
@ -9,8 +9,10 @@
|
||||
if(!isset($selectedTimezone)){
|
||||
//I don't have any error message set here. It will just reload the page.
|
||||
} else{
|
||||
$origHour = date('O');
|
||||
$originalTZ = date_default_timezone_get();
|
||||
date_default_timezone_set($selectedTimezone);
|
||||
$scriptHour = date('O');
|
||||
$scriptTZ = date_default_timezone_get();
|
||||
}
|
||||
} else{
|
||||
@ -52,6 +54,10 @@
|
||||
"</p><p> GMT". date("O T") .'</p></span>';
|
||||
date_default_timezone_set($scriptTZ);
|
||||
}
|
||||
if($_POST['displayOffset']){
|
||||
$tzDifferance = (-1 * ($origHour - $scriptHour)) * 0.01;
|
||||
echo '<p>The difference between the timezones is ' . $tzDifferance . ' hours</p>';
|
||||
}
|
||||
?>
|
||||
<div class="tz_select">
|
||||
<p>
|
||||
@ -103,6 +109,10 @@
|
||||
<br/>
|
||||
<label for="originalTZ">Display original timezone</label>
|
||||
<input type="checkbox" name="originalTZ" value="origTZ">
|
||||
<span class="chkbox>
|
||||
<label for="displayOffset">Display offset of selected timezones</label>
|
||||
<input type="checkbox" name="displayOffset" value="disOS"/>
|
||||
</span>
|
||||
</form>
|
||||
<p id="JStz"><?php echo date("e");?></p>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user