Understanding Skyview (or js or the browser logic ?)

Hi,
I just installed skyview, working with dump1090-mutability (see Tweaks - #76 by Patrius).
By working on a problem I noticed date and time are different in different browers on the same windows 10 computer , see screenshot
I work with an ‘english’ windows , region format = english(belgium), what is the reason of the differences ?
Tihs is ofcourse a non issue, but a little bit irritatingfor me , I don’t like the american mm/dd and the am/pm
Thanks for any reaction.

thing.

It uses Date.toLocaleString(): JavaScript Date toLocaleString() Method
It seems that Chrome/Firefox’s implementation of this does not correctly reflect your locale settings.

FWIW, Skyview on Chrome here produces 02/09/2018, so this is probably a locale setting within Chrome itself that you need to tweak.

Also if you could comment on Why do you use dump1090-mutability? that’d be great - I am trying to discover why these unusual combinations of piaware/skyview/dump1090-mutability are popular.

Thanks I will look into this.

I manged to correct in chrome, but Firefox is stubborn

me too, specially time in aviation ALWAYS is 24 hr clock format.

having said that, I found a remedy. easy.

by editing sudo nano usr/share/dump1090-fa/html/script.js
then CTRL + _ (underscore), in the nano (line,column prompt, put 1028 and ENTER)

just after that line, alter the code as follows

// NEED 24hr CLOCK and dd-mm-yyyy !

function refreshClock() {

// ORIG ==>     $('#clock_div').text(new Date().toLocaleString());

//-------------------------------//

        var dateNbr = new Date();
        var sDate = dateNbr.getDate();
        var sMonth = dateNbr.getMonth() + 1 ;
        var sYear = dateNbr.getFullYear();

        var sHours = dateNbr.getHours();
        var sMins = dateNbr.getMinutes();
        var sSecs = dateNbr.getSeconds();

        var TimeZoneID = "EEST";   // Eastern European Standard Time

        if (sDate < 10 )
           sDate = ("0" + sDate);

        if (sMonth < 10 )
           sMonth = ("0" + sMonth);

        if (sHours < 10 )
           sHours = ("0" + sHours);
        if (sMins < 10 )
           sMins = ("0" + sMins);
        if (sSecs < 10 )
           sSecs = ("0" + sSecs);

        var DateTimeStr = (sDate + "-"+ sMonth + "-" + sYear + " __   " + sHours + ":" + sMins + ":" + sSecs + " __  " + TimeZoneID);

        $('#clock_div').text(DateTimeStr);

//-----------------------------------//

and that’s all. what you get is this

now you would probably need to change ‘EEST’ to “CEST” to reflect your Belgian time zone.

HTH
evangel

ED1 : more meaningful variable names.
ED2: corrected the month calc.

1 Like

HI,
very nice , but you have to add 1 to the month, js returns with getMonth the month nr from 0 to 11.

thanks for the catch. I updated the code !

Hi,
I changed it a little bit for my taste,
now showing

image

I changed the value of TimeZoneID :

 var TimeZoneID = dateNbr.toString().slice(25,31);

and added the ‘h’ in the result

var DateTimeStr = (sDate + "/"+ sMonth + "/" + sYear + " " + sHours + ":" + sMins + ":" + sSecs + "  " + TimeZoneID + "h");
1 Like

That’s gross


PS: That’s a joke only :rofl:

Obligatory xkcd

2 Likes

I flew a long time ago in vacation in Europe (in my native country) and, at that time I had a US Permanent Resident Card (aka Green Gard).
When I was to come back in US, early morning flight, the lady at the counter asks for my passport and visa (before she can give me my boarding pass). I said "don’t need a visa, I have a Green Card. She wants to see it, and then she says “I am sorry, I cannot let you board the flight, your card is expired”. I look at the card and I say “No, it’s not”. She is “Yes, it is, you need to talk to the American Consulate about that. Have a good day”.
I was blocked for a few seconds (didn’t had my coffee yet). Date was June something, my card was expiring in (my brain translates) December 5th. WHF?
Then it struck me. The card had only numbers, not words, for dates, since it is meant to be used only in US. “Expires in 12/05/200x”.
She thought it expired in May, when it was good till December. I was gonna lose my non-refundable $1500 flight because that! I asked for a supervisor and, in a very stern voice, I said “if you can’t read a date on an US document, please let someone else do this job!”
All was happening in my native language, so I might have slipped something under my breath (that she understood), but quickly printed the boarding passes.

During the years I worked (until 1.5 year ago , I’m now retired) I encountered 1 country in the “country database” of the software (SAP) we used at the company that had the “official” date in ISO format : Hungary
I use it when I’m naming files/folders with a date starting in the description, sorts them nicely.

2 Likes

The ISO Date Format of Raspbian Distros

ISO%20date%20on%20Raspbian%20Distros

.