Fix an error attempting to update missing value.

The original timezone display was attempting to be updated even when it
was not displayed.
This commit is contained in:
20xd6 2021-05-09 15:19:44 -04:00
parent dbad2b51a4
commit 3cc49403c9
2 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,8 @@ function startTime(){
hour:'2-digit',
minute:'2-digit',
second:'2-digit',});
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.
if(display_origTZ){//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.
//~ alert("display_origTZ == " + display_origTZ);
document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{
timeZone: original_tz,
hourCycle:'h24',

View File

@ -15,6 +15,9 @@
$scriptHour = date('O');
$scriptTZ = date_default_timezone_get();
}
if($_POST['originalTZ']){
$orig_TZ_display = True;
}
} else{
$selectedTimezone = date_default_timezone_get();
$scriptTZ = date_default_timezone_get();
@ -32,7 +35,7 @@
<meta name="author" content="efrick"/>
<link href="/styles.css" type="text/css" rel="stylesheet"/>
<link href="clock.css" type="text/css" rel="stylesheet"/>
<script>var current_tz=<?php echo json_encode($scriptTZ) . ',original_tz = ' . json_encode($originalTZ);?></script>
<script>var current_tz=<?php echo json_encode($scriptTZ) . ',original_tz = ' . json_encode($originalTZ) . ',display_origTZ = ' . json_encode($orig_TZ_display);?></script>
<script type="text/javascript" src="clock.js"></script>
</head>
<body>