diff --git a/README.md b/README.md index f280241..75790fb 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,11 @@ A javascript interpriter - Basicaly a modernish webbrowser. 1. Edit `clock.php` to point to your CSS files. 2. Add a symlink from `clock.php` to a file called `index.php`. `ln -s clock.php index.php` - +#### Note: +There is a small privacy concern. Because this clock is using PHP to creat the inishal time entry and because this is using the `date()` function in PHP to do this it will reveal what timezone the server running it is set to. ### ToDo +- [ ] Add a differentiator from the selected timezone and the origonal timezone. +- - [ ] Display original timezone's time. +- - [ ] Display the offset of the two selected timezones. - [ ] Add a timer. - [ ] Multiple clocks for tracking regions. \ No newline at end of file diff --git a/clock.css b/clock.css index 501a467..18d440c 100644 --- a/clock.css +++ b/clock.css @@ -1,3 +1,6 @@ span p{ display:inline; } +select { + max-width: 95%; +} diff --git a/clock.js b/clock.js index 6132016..2b6c2c5 100644 --- a/clock.js +++ b/clock.js @@ -34,5 +34,18 @@ function startTime(){ hour:'2-digit', minute:'2-digit', second:'2-digit',}); + if(original_tz != null){ + document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{ + timeZone: original_tz, + dateStyle:'long', + hourCycle:'h24', + weekday:'short', + month:'short', + day:'2-digit', + year:'numeric', + hour:'2-digit', + minute:'2-digit', + second:'2-digit'}); + } document.getElementById('JStz').innerHTML = current_tz; } diff --git a/clock.php b/clock.php index aaf63a8..1bd394b 100644 --- a/clock.php +++ b/clock.php @@ -9,6 +9,7 @@ if(!isset($selectedTimezone)){ //I don't have any error message set here. It will just reload the page. } else{ + $originalTZ = date_default_timezone_get(); date_default_timezone_set($selectedTimezone); $scriptTZ = date_default_timezone_get(); } @@ -29,7 +30,7 @@ - + @@ -43,7 +44,15 @@ "

". date("D, M d, Y, H:i:s") . "

GMT". date("O T") ."

\n\t\t"; - ?> + if($_POST['originalTZ']){// if the user want display the browser detected timezone as well as the selected one. + date_default_timezone_set($originalTZ); + echo'

Time in original Timezone

'. + '

'. + date("D, M d, Y, H:i:s") . + "

GMT". date("O T") .'

'; + date_default_timezone_set($scriptTZ); + } + ?>

If the detcted timezone is not correct selct your timezone from the dropdown below. @@ -90,10 +99,12 @@ - +
+ + -

JS Timezone

+