Small fixes for the weather js

This commit is contained in:
Wesley Moore 2011-05-06 21:36:17 +10:00
parent 703c05e9a5
commit e717ffd74d

View file

@ -42,8 +42,8 @@
function datetimeString(date) { function datetimeString(date) {
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
return [ return [
date.getUTCDate(), date.getDate(),
months[date.getUTCMonth()], months[date.getMonth()],
timeString(date) timeString(date)
].join(' ') ].join(' ')
} }
@ -65,17 +65,10 @@
// Register Handlebars date helpers // Register Handlebars date helpers
var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
Handlebars.registerHelper('day', function(date) { Handlebars.registerHelper('day', function(date) { return days[date.getDay()] });
return days[date.getDay()]; Handlebars.registerHelper('time', function(date) { return timeString(date) });
}); Handlebars.registerHelper('isoDate', function(date) { return isoString(date) });
Handlebars.registerHelper('datetime', function(date) { return datetimeString(date) });
Handlebars.registerHelper('time', function(date) {
return timeString(date);
});
Handlebars.registerHelper('isoDate', function(date) {
return isoString(date);
});
jQuery(function() { jQuery(function() {
// Compile templates // Compile templates
@ -87,10 +80,7 @@
// Populate the current conditions // Populate the current conditions
var current = { var current = {
temperature: data.current.temperature_out, temperature: data.current.temperature_out,
timestamp: function() { timestamp: new Date(data.current.timestamp),
var d = new Date(data.current.timestamp);
return datetimeString(d);
},
// min_temp: data.current.min.temperature, // min_temp: data.current.min.temperature,
// min_date: new Date(data.current.min.timestamp), // min_date: new Date(data.current.min.timestamp),
// min_datetime: function() { // min_datetime: function() {