I’m playing with the SimpleWeather jquery plugin, on an asp.net page and its working fine.
https://github.com/monkeecreate/jquery.simpleWeather
I just have 2 questions:
-
I get the times in AM and PM, is there someone thats know how to fix it to 24H.
-
If i know the weather.code http://developer.yahoo.com/weather/#codes can I then somehow us my own names for hot, hail, and so on?
$.getJSON(
weatherUrl,
function (data) {
if (data !== null && data.query.results !== null) {
$.each(data.query.results, function (i, result) {
if (result.constructor.toString().indexOf(“Array”) !== -1) {
result = result[0];
}var currentDate = new Date(); var sunRise = new Date(currentDate.toDateString() + ' ' + result.astronomy.sunrise); var sunSet = new Date(currentDate.toDateString() + ' ' + result.astronomy.sunset); if (currentDate > sunRise && currentDate < sunSet) { var timeOfDay = 'd'; } else { var timeOfDay = 'n'; }
If u need to show 24H time with the SimpleWeather jQuery plugin, then the solution from Yuriy is not working…
But here is a working solution.
In the js script find this code.
And then changes that code to this (there is some issue with the sunset in 24H if the sunset is 20:05 then it showed the time as 20:5 i dident show the xx:0x first 0 in the MM-time, this code is fixing that issue)
Remember to use SunSetTime and SunRiseTime if showing 24H and not the AM/PM ex. SunSet and SunRise.
And it also fix the issue for the HH-time if there is an issue with the first 0 in hours also.
Happy using…