Skip to content

Commit a7dbe9d

Browse files
committed
Use moment.js to own and update forecast updated time from epoch
Updates #56
1 parent 0b9af5b commit a7dbe9d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: bin/user/belchertown.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def get_extension_list(self, timespan, db_lookup):
434434
forecast_alert_text += "<i class='fa fa-exclamation-triangle'></i> <a href='%s' target='_blank'>%s in effect until %s</a><br>" % ( alert['uri'], alert['title'], alert_expires )
435435

436436
forecast_html_output = ""
437-
forecast_updated = time.strftime( "%c", time.localtime( data["currently"]["time"] ) )
437+
forecast_updated = data["currently"]["time"]
438438
current_obs_summary = data["currently"]["summary"]
439439
visibility = data["currently"]["visibility"]
440440

Diff for: skins/Belchertown/index.html.tmpl

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
daily(); // Initial load daily highcharts
5353
#end if
5454

55+
#if $Extras.has_key("forecast_alert_enabled") and $Extras.forecast_alert_enabled == '1'
56+
forecast_subtitle = moment.unix( $forecast_updated ).format( 'LLL' );
57+
jQuery(".forecast-subtitle").text( "Last Updated on " + forecast_subtitle );
58+
#end if
59+
5560
#if $Extras.has_key('earthquake_enabled') and $Extras.earthquake_enabled == '1'
5661
jQuery(".earthquake-time").html( moment.unix( $earthquake_time ).format( 'LLL' ) );
5762
#end if
@@ -956,7 +961,7 @@
956961
<!-- Forecast -->
957962
<div class="col-lg-12 forecast">
958963
<div class="forecast-title">
959-
8 Day Forecast <span class="forecast-subtitle">Last Updated on $forecast_updated</span>
964+
8 Day Forecast <span class="forecast-subtitle"></span><!-- moment.js -->
960965
</div>
961966
<div class="row forecasts">
962967
$forecastHTML

0 commit comments

Comments
 (0)