QUOTE(bluffwood @ Jan 4 2017, 06:33 PM)
if by 5 times, you mean 5 stations? That's not fixed. It's going to grow.
Ok, but it won't be so many that it would be a bother to edit the script as it is, I think?
QUOTE
QUOTE
I think it will always be Sunday in all the American zones when the show airs. If not, well, this won't work.
We have one station airing on Saturday already, but they don't stream so it wouldn't be on the list
Good. Cause I don't think I would be able to figure that one out.
QUOTE
But I'm confused why day of the week enters into this. Sure, if it plays in New Zealand 12 hours ahead of us, it airs tomorrow (or very late tonight) but the day of week would always be fixed. Simply in the text. Not really relevant to the local time.
It's just to be able to calculate the date of the coming Sunday. If we know the day of the week we also know how many days it is to Sunday. And that number can be added to the date so we get the correct date and JS will know if DS should be used or not. As it is now the correct UTC date is in the utcdate variable. That way JavaScript will use DS if it's in use the coming Sunday. Before I thought of that and the same date was used all the time, DS would be used according to that fixed date and not the date of the coming Sunday. I said this is confusing!
Say DS was to be turned off the coming night to Sunday (as it will happen towards summer). Someone goes to your site on Saturday to check when the show airs the next day. Without the correct date for the Sunday he would get the time with DS as it's still in use on Saturday if we used his local date and if we used a fixed date it would be even worse. When the date used is that for the actual Sunday JS knows not to use DS. I hope!
QUOTE
Don't need the name of the timezone or the +/- UCT. presuming it's local time unless they're sneaking around with a fake location via a vpn.
I know. But we need a correctly formatted date for JS to be able to handle it, can't leave things out.
QUOTE
QUOTE
One option would be to list the times in the local time for the station as you do now and add the user's local time after. Personally I could live with that. Maybe it would even be a good thing to show both times. Come to think of it, I think I like this the best. Something like this.
CODE
Saturday Noon CT (<span id="airing_1"></span> in your local time) on station A
yes, I quite like that idea.
I'm glad. Living in Sweden I get get this localization crap all the time. Getting pages translated to (poor) Swedish without an option to read them in English is the worst case. Always let the user have a choice, I say. In your case, a person could very well live in one time zone and work in another. If he looks the airing time up from work during the week he would get the time in that time zone, not the time at home where he'll be listening. So good to have both, I think.
If you want to use it, you just need to edit in three places.
1. Add a new airtime block. All you need to do here is to copy a block and edit the hour in UTC time (I guess I could have automated the conversion, but I leave it to you do look the correct UTC times up) and change the numbers in the variable names (the third could use 3 and so on). Clever of me to use numbers, wasn't it?
Note the space before the time stamp in ' 17:00:00 UTC'.
//
First airtime
var airTimeUTC_
1 = new Date(utcdate + '
17:00:00 UTC'); // Enter UTC time here!
var airTimeEpoch_
1 = airTimeUTC_
1.getTime(); // Converts to Epoch
var localAirTime_
1 = new Date(airTimeEpoch_
1); // Gets the local date and time
var hour_
1 = localAirTime_
1.getHours(); // Gets the hour out
2. Add another line with what should be injected in the HTML. Again, edit the number in the variable and also the number in the id. The id is in the parentheses and is used in the SPAN tag in the HTML. This is what lets JS know *where* it should put the stuff.
document.getElementById('airing_
1').innerHTML = '(' +
hour_1 + ' in your local time)';
3. Lastly add another snip to the HTML. Edit the number in the name of the id and also the hard coded bits.
Sunday Noon CT <span id="
airing_1"></span> on station
ASo it's quite easy. Just copy and change the numbers. As said, you can format the HTML as you please. Want it in a table, put it in a table. The converted hour will turn up where the SPAN with the corresponding ID is.
Just hope I haven't missed something. As said, it's tricky, this. Don't shoot me if something goes wrong on leap day or something like that!