Skip to content

Commit

Permalink
Getting proper dates passed in the url and with dst.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanramage committed Jul 19, 2012
1 parent 4b84fa7 commit 904d325
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 393 deletions.
2 changes: 1 addition & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"js/lib/jquery.timeago.js",
"js/lib/geo.js",
"js/lib/date-utils.min.js",
"js/lib/moment.min.js",
"js/lib/fullcalendar.min.js",
"js/lib/jquery.jplayer.js",
"js/lib/jquery.mentionsInput.js",
Expand All @@ -52,7 +53,6 @@
"js/liferecorder.jquery.js",
"js/timeline.audioplayer.js",
"js/eckoit.mentionsInput.js",
"js/import.support.js",
"js/app.js",
"js/onready.js"
);
Expand Down
28 changes: 17 additions & 11 deletions html/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,13 @@ app.controller.findClosest = function getClosest(geohash, resolution, callbackB


app.controller.parseRequestedDate = function(date) {
console.log(date);
return moment(date, 'YYYY-MM-DDTHH:mm:ssZZ').toDate();
}

date = unescape(date);
date = date.replace(/_/g," ");
var resultDate = new Date(Date.parse(date));
if (!resultDate) {
resultDate = new Date(date);
}


return resultDate;

app.controller.stringifyDate = function(date) {
var m = moment(date);
return m.format('YYYY-MM-DDTHH:mm:ssZZ');
}


Expand Down Expand Up @@ -739,13 +735,14 @@ app.controller.createTimeline = function(initialDate) {
if (!initialDate) initialDate = new Date();


var utcOffset = initialDate.getUTCOffset();
var utcOffset = new Date().getUTCOffset();

// hack attack. Not sure what timeline really wants?
var timeZoneOffset = parseInt(utcOffset[0] + utcOffset[2]);
var eventSource = new Timeline.DefaultEventSource();
SimileAjax.History.enabled = false;
var theme = Timeline.ClassicTheme.create();
var tempStartDate = new Date();
var bandInfos = [
Timeline.createBandInfo({
overview: true,
Expand Down Expand Up @@ -778,6 +775,10 @@ app.controller.createTimeline = function(initialDate) {

var tl = Timeline.create(document.getElementById("timeline-ui"), bandInfos);

tl.getBand(0).setCenterVisibleDate(initialDate);



// add a playhead
var playhead = $('<div id="playhead"></div>');
$('#timeline-ui').append(playhead);
Expand Down Expand Up @@ -822,6 +823,11 @@ app.controller.createTimeline = function(initialDate) {
audioQuery : app.controller.audioQuery,
audioNext : app.controller.audioNext
});
$('.timelineplayer').bind('timeline.audioplayer.views.updatedate', function(e, data) {
var date = app.controller.stringifyDate(data.centreDate);
history.replaceState({}, date, "#/calendar/" + date);

});
}


Expand Down
118 changes: 0 additions & 118 deletions html/js/import.support.js

This file was deleted.

6 changes: 6 additions & 0 deletions html/js/lib/moment.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions html/js/lib/timeline_2.3.1/timeline_js/timeline-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,11 +1768,14 @@ Timeline.GregorianDateLabeller.prototype.labelInterval=function(A,C){var B=Timel
if(B==null){B=Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
}return B.call(this,A,C);
};
Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toUTCString();
Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){
var mo = moment(A.getTime());
return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toUTCString();
//Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toLocaleDateString();
};
Timeline.GregorianDateLabeller.prototype.defaultLabelInterval=function(B,F){var C;
var E=false;
var originalDate = moment(B);
B=SimileAjax.DateTime.removeTimeZoneOffset(B,this._timeZone);
switch(F){case SimileAjax.DateTime.MILLISECOND:C=B.getUTCMilliseconds();
break;
Expand All @@ -1789,12 +1792,7 @@ case SimileAjax.DateTime.HOUR:
C=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate();
} else {
var ampm = 'am';
var hrs = B.getUTCHours();
var hrs12 = hrs % 12;
if (hrs >= 12) ampm = 'pm';
if (hrs == 12) hrs12 = 12;
C=hrs12 + ampm;

C = originalDate.format('ha');
//C=B.getUTCHours()+"hr";
}
break;
Expand Down
Loading

0 comments on commit 904d325

Please sign in to comment.