Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 2 contributors
14 src/main/webapp/widgets/campusevents/javascript/campusevents.js
@@ -28,14 +28,18 @@ calcentral.Widgets.campusevents = function(tuid) {
28 28
29 29 $.each(data.item, function(index, value){
30 30 // Campus events feed does not include a date property; appends date as URL param instead
31   - var urldate = calcentral.Api.Util.parseURI({'url':value.link}).queryKey.date;
32   - var eventDate = new Date(urldate);
  31 + var urldate = calcentral.Api.Util.parseURI({
  32 + 'url': value.link
  33 + }).queryKey.date.split('-');
  34 +
  35 + var eventDate = new Date();
  36 + eventDate.setFullYear(urldate[0], parseInt(urldate[1], 10) - 1, urldate[2]);
33 37
34 38 // #todo Another reason we need a good JS date lib
35 39 var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
36 40 var shortDay = weekdays[eventDate.getDay()];
37   - var theMonth = eventDate.getMonth() + 1;
38   - data.item[index].friendlyDate = shortDay + ' ' + theMonth + '/' + eventDate.getDate();
  41 + var theMonth = parseInt(urldate[1], 10);
  42 + data.item[index].friendlyDate = shortDay + ' ' + theMonth + '/' + parseInt(urldate[2], 10);
39 43 });
40 44 return data;
41 45 };
@@ -59,7 +63,7 @@ calcentral.Widgets.campusevents = function(tuid) {
59 63 var getFeed = $.Deferred();
60 64 $.ajax({
61 65 'dataType': 'json',
62   - 'url': 'http://query.yahooapis.com/v1/public/yql?q=select%20title%2C%20link%20from%20rss%20where%20url%3D%22http%3A%2F%2Fevents.berkeley.edu%2Findex.php%2Frss%2Fsn%2Fpubaff%2Ftype%2Fday%2Ftab%2Fall_events.html%22%20limit%204&format=json&callback=',
  66 + 'url': '//query.yahooapis.com/v1/public/yql?q=select%20title%2C%20link%20from%20rss%20where%20url%3D%22http%3A%2F%2Fevents.berkeley.edu%2Findex.php%2Frss%2Fsn%2Fpubaff%2Ftype%2Fday%2Ftab%2Fall_events.html%22%20limit%204&format=json&callback=',
63 67 'success': getFeed.resolve,
64 68 'error': function() {
65 69 getFeed.resolve({});

No commit comments for this range

Something went wrong with that request. Please try again.