Use local_time gem for timezone replacement (#2174)
For the 'time ago' value of stream entry simple statuses and the timestamp value of detailed statuses - output their UTC value and use the browser timezone to convert locally.pull/2173/merge
parent
5c9aa2b732
commit
452dc6b5fe
1
Gemfile
1
Gemfile
|
@ -35,6 +35,7 @@ gem 'http_accept_language'
|
||||||
gem 'httplog'
|
gem 'httplog'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'link_header'
|
gem 'link_header'
|
||||||
|
gem 'local_time'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
gem 'oj'
|
gem 'oj'
|
||||||
gem 'ostatus2', '~> 1.1'
|
gem 'ostatus2', '~> 1.1'
|
||||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -111,6 +111,13 @@ GEM
|
||||||
cocaine (0.5.8)
|
cocaine (0.5.8)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
climate_control (>= 0.0.3, < 1.0)
|
||||||
coderay (1.1.1)
|
coderay (1.1.1)
|
||||||
|
coffee-rails (4.2.1)
|
||||||
|
coffee-script (>= 2.2.0)
|
||||||
|
railties (>= 4.0.0, < 5.2.x)
|
||||||
|
coffee-script (2.4.1)
|
||||||
|
coffee-script-source
|
||||||
|
execjs
|
||||||
|
coffee-script-source (1.12.2)
|
||||||
colorize (0.8.1)
|
colorize (0.8.1)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
connection_pool (2.2.1)
|
connection_pool (2.2.1)
|
||||||
|
@ -224,6 +231,8 @@ GEM
|
||||||
letter_opener (~> 1.0)
|
letter_opener (~> 1.0)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
link_header (0.0.8)
|
link_header (0.0.8)
|
||||||
|
local_time (1.0.3)
|
||||||
|
coffee-rails
|
||||||
lograge (0.4.1)
|
lograge (0.4.1)
|
||||||
actionpack (>= 4, < 5.1)
|
actionpack (>= 4, < 5.1)
|
||||||
activesupport (>= 4, < 5.1)
|
activesupport (>= 4, < 5.1)
|
||||||
|
@ -500,6 +509,7 @@ DEPENDENCIES
|
||||||
letter_opener
|
letter_opener
|
||||||
letter_opener_web
|
letter_opener_web
|
||||||
link_header
|
link_header
|
||||||
|
local_time
|
||||||
lograge
|
lograge
|
||||||
microformats2
|
microformats2
|
||||||
nokogiri
|
nokogiri
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require extras
|
//= require extras
|
||||||
//= require best_in_place
|
//= require best_in_place
|
||||||
|
//= require local_time
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$(".best_in_place").best_in_place();
|
$(".best_in_place").best_in_place();
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
%div.detailed-status__meta
|
%div.detailed-status__meta
|
||||||
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
||||||
= link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do
|
= link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do
|
||||||
%span= l(status.created_at)
|
%span= local_time(status.created_at, format: :default)
|
||||||
·
|
·
|
||||||
- if status.application
|
- if status.application
|
||||||
- if status.application.website.blank?
|
- if status.application.website.blank?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.status.light
|
.status.light
|
||||||
.status__header
|
.status__header
|
||||||
.status__meta
|
.status__meta
|
||||||
= link_to time_ago_in_words(status.created_at), TagManager.instance.url_for(status), class: 'status__relative-time u-url u-uid', title: l(status.created_at), target: stream_link_target, rel: 'noopener'
|
= link_to local_time_ago(status.created_at), TagManager.instance.url_for(status), class: 'status__relative-time u-url u-uid', title: l(status.created_at), target: stream_link_target, rel: 'noopener'
|
||||||
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
||||||
|
|
||||||
= link_to TagManager.instance.url_for(status.account), class: 'status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
|
= link_to TagManager.instance.url_for(status.account), class: 'status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
|
||||||
|
|
Loading…
Reference in New Issue