diff --git a/app/views/content_exports/index.html.erb b/app/views/content_exports/index.html.erb index a2fc169704d..4f1e0cc7d86 100644 --- a/app/views/content_exports/index.html.erb +++ b/app/views/content_exports/index.html.erb @@ -19,11 +19,11 @@

<% if export.export_type == 'common_cartridge' %> <%= t 'links.download', "Course Export from %{date}: *Click here to download*", - :date => "#{datetime_string export.created_at}".html_safe, + :date => "#{datetime_string export.created_at}".html_safe, :wrapper => link_to('\1', export.attachment ? verified_file_download_url(export.attachment) : nil) %> <% else %> <%= t 'links.download_qti', "QTI Export from %{date}: *Click here to download*", - :date => "#{datetime_string export.created_at}".html_safe, + :date => "#{datetime_string export.created_at}".html_safe, :wrapper => link_to('\1', export.attachment ? verified_file_download_url(export.attachment) : nil) %> <% end %>

diff --git a/app/views/context/_inbox_item.html.erb b/app/views/context/_inbox_item.html.erb index 301ca0a131c..a9258002bc7 100644 --- a/app/views/context/_inbox_item.html.erb +++ b/app/views/context/_inbox_item.html.erb @@ -3,7 +3,7 @@
">
diff --git a/app/views/context/roster_user_usage.html.erb b/app/views/context/roster_user_usage.html.erb index 6bd5d0ede63..2345b0bdea6 100644 --- a/app/views/context/roster_user_usage.html.erb +++ b/app/views/context/roster_user_usage.html.erb @@ -75,7 +75,7 @@ <%= access.corrected_view_score %> <%= access.participate_score %> - <%= datetime_string(access.last_access) %> + <%= datetime_string(access.last_access) %> <% end %> diff --git a/app/views/discussion_topics/_entry.html.erb b/app/views/discussion_topics/_entry.html.erb index f6c25ce93fd..0ad8ece12b1 100644 --- a/app/views/discussion_topics/_entry.html.erb +++ b/app/views/discussion_topics/_entry.html.erb @@ -51,7 +51,7 @@
<% end %> - +
<% end %>
diff --git a/app/views/discussion_topics/_sub_entry.html.erb b/app/views/discussion_topics/_sub_entry.html.erb index 4bb19f6fa92..4080f69334b 100644 --- a/app/views/discussion_topics/_sub_entry.html.erb +++ b/app/views/discussion_topics/_sub_entry.html.erb @@ -9,7 +9,7 @@ -
<%= datetime_string(entry.try_rescue(:created_at)) || nbsp %>
+
<%= datetime_string(entry.try_rescue(:created_at)) || nbsp %>
diff --git a/app/views/user_notes/_user_note.html.erb b/app/views/user_notes/_user_note.html.erb index 176fbb44209..916fe2b929d 100644 --- a/app/views/user_notes/_user_note.html.erb +++ b/app/views/user_notes/_user_note.html.erb @@ -2,7 +2,6 @@ id = user_note.new_record? ? 'user_note_blank' : "user_note_#{user_note.id}" style = user_note.new_record? ? 'display: none;' : '' creator = user_note.creator.try_rescue(:name) || nil - created_at = datetime_string(user_note.try_rescue(:created_at)) || nil %>
@@ -22,17 +21,15 @@
<%= user_note.try_rescue(:title) || t(:no_title, "No Title") %>
- <% if creator || created_at %> + <% if creator || user_note.created_at %>
- - <% if creator && created_at %> - <%= t 'subheader', "%{creator} on %{created_at}", :creator => creator, :created_at => created_at %> + <% if creator && user_note.created_at %> + <%= t 'subheader', "%{creator} on %{created_at}", :creator => creator, :created_at => datetime_string(user_note.created_at) %> <% elsif creator %> <%= creator %> - <% elsif created_at %> - <% created_at %> + <% elsif user_note.created_at %> + <%= datetime_string user_note.created_at %> <% end %> -
<% end %>
diff --git a/public/javascripts/instructure.js b/public/javascripts/instructure.js index 5f7b1a5d17c..4f3a97806ad 100644 --- a/public/javascripts/instructure.js +++ b/public/javascripts/instructure.js @@ -22,7 +22,6 @@ define([ 'i18n!instructure', 'jquery' /* $ */, 'underscore', - 'timezone', 'compiled/userSettings', 'str/htmlEscape', 'wikiSidebar', @@ -32,7 +31,7 @@ define([ 'jquery.doc_previews' /* filePreviewsEnabled, loadDocPreview */, 'jquery.dropdownList' /* dropdownList */, 'jquery.google-analytics' /* trackEvent */, - 'jquery.instructure_date_and_time' /* parseFromISO, dateString */, + 'jquery.instructure_date_and_time' /* parseFromISO, dateString, fudgeDateForProfileTimezone */, 'jquery.instructure_forms' /* formSubmit, fillFormData, formErrors */, 'jqueryui/dialog', 'jquery.instructure_misc_helpers' /* replaceTags, youTubeID */, @@ -54,7 +53,7 @@ define([ 'compiled/badge_counts', 'vendor/scribd.view' /* scribd */, 'vendor/jquery.placeholder' -], function(KeyboardNavDialog, INST, I18n, $, _, tz, userSettings, htmlEscape, wikiSidebar) { +], function(KeyboardNavDialog, INST, I18n, $, _, userSettings, htmlEscape, wikiSidebar) { $.trackEvent('Route', location.pathname.replace(/\/$/, '').replace(/\d+/g, '--') || '/'); @@ -759,8 +758,7 @@ define([ // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvv BEGIN stuf form making pretty dates vvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - var timeZoneOffset = tz.currentOffset() / -60, - timeAgoEvents = []; + var timeAgoEvents = []; function timeAgoRefresh() { timeAgoEvents = $(".time_ago_date:visible").toArray(); processNextTimeAgoEvent(); @@ -769,31 +767,13 @@ define([ var eventElement = timeAgoEvents.shift(); if (eventElement) { var $event = $(eventElement), - originalDate = $event.data('original_date') || "", - date = $event.data('parsed_date') || ( originalDate ? - Date.parse(originalDate.replace(/ (at|by)/, "")) : - Date.parse(($event.text() || "").replace(/ (at|by)/, "")) ); + date = $event.data('parsed_date') || Date.parse($event.data('timestamp') || ""); if (date) { - var now = new Date(); - now.setDate(now.getDate() + 1); - if (!originalDate && date > now && date - now > 3600000) { - var year = date.getUTCFullYear().toString(); - if(date > now && date.getUTCFullYear() == now.getUTCFullYear() && !$event.text().match(year)) { - date.setUTCFullYear(date.getUTCFullYear() - 1); - } - } - var timeZoneDiff = now.getTimezoneOffset() - timeZoneOffset; - if(isNaN(timeZoneDiff)) { timeZoneDiff = 0; } - var diff = now - date + (timeZoneDiff * 60 * 1000); - $event.data('original_date', date.toString("MMM d, yyyy h:mmtt")); + var diff = new Date() - date; + $event.data('timestamp', date.toISOString()); $event.data('parsed_date', date); - // This line would compensate for a user who set their time zone to something - // different than the time zone setting on the current computer. It would adjust - // the times displayed to match the time zone of the current computer. This could - // be confusing for a student since due dates and things will NOT be adjusted, - // so dates and times will not match up. - // date = date.addMinutes(-1 * timeZoneDiff); - var defaultDateString = date.toString("MMM d, yyyy") + date.toString(" h:mmtt").toLowerCase(); + var fudgedDate = $.fudgeDateForProfileTimezone(date); + var defaultDateString = fudgedDate.toString("MMM d, yyyy") + fudgedDate.toString(" h:mmtt").toLowerCase(); var dateString = defaultDateString; if(diff < (24 * 3600 * 1000)) { if(diff < (3600 * 1000)) {