Merge branch '24hour' into 'dev'

24-hour time fixes

See merge request fatchan/jschan!178
merge-requests/208/head
Thomas Lynch 4 years ago
commit 77af931bf8
  1. 4
      gulp/res/js/localstorage.js
  2. 4
      gulp/res/js/time.js
  3. 4
      views/mixins/ban.pug
  4. 2
      views/mixins/newspost.pug
  5. 4
      views/mixins/post.pug
  6. 2
      views/mixins/report.pug
  7. 2
      views/pages/editpost.pug
  8. 2
      views/pages/globalmanagelogs.pug
  9. 2
      views/pages/home.pug
  10. 2
      views/pages/managelogs.pug
  11. 2
      views/pages/modlog.pug

@ -36,12 +36,12 @@ function setDefaultLocalStorage(key, value) {
//todo: just make the localstorage name match the names of settings and put a loop
setDefaultLocalStorage('volume', settings.defaultVolume);
setDefaultLocalStorage('loop', settings.loop);
setDefaultLocalStorage('imageloadingbars', settings.imageLoadingBard);
setDefaultLocalStorage('imageloadingbars', settings.imageLoadingBars);
setDefaultLocalStorage('live', settings.live);
setDefaultLocalStorage('scroll', settings.sctollToPosts);
setDefaultLocalStorage('localtime', settings.localTime);
setDefaultLocalStorage('relative', settings.relativeTime);
setDefaultLocalStorage('24hour', settings.hour24time);
setDefaultLocalStorage('24hour', settings.hour24Time);
setDefaultLocalStorage('notifications', settings.notificationsEnabled);
setDefaultLocalStorage('notification-yous-only', settings.notificationsYousOnly);
setDefaultLocalStorage('yous-setting', settings.showYous);

@ -50,13 +50,13 @@ const relativeTimeString = (date) => {
const changeDateFormat = (date) => {
const options = {
hourCycle: hour24 ? 'h23' : 'h12',
hour12: !hour24
};
if (!localTime) {
options.timeZone = SERVER_TIMEZONE;
}
const dateString = new Date(date.dateTime).toLocaleString('en-US', options);
const locale = hour24 ? 'en-US-u-hc-h23' : 'en-US';
const dateString = new Date(date.dateTime).toLocaleString(locale, options);
if (relativeTime) {
date.innerText = relativeTimeString(date.dateTime);
date.title = dateString;

@ -15,9 +15,9 @@ mixin ban(ban, banpage)
td #{ban.type}
td #{ban.issuer}
- const banDate = new Date(ban.date);
td: time.right.reltime(datetime=banDate.toISOString()) #{banDate.toLocaleString(undefined, {hour12:false})}
td: time.right.reltime(datetime=banDate.toISOString()) #{banDate.toLocaleString(undefined, {hourCycle:'h23'})}
- const expireDate = new Date(ban.expireAt);
td: time.right.reltime(datetime=expireDate.toISOString()) #{expireDate.toLocaleString(undefined, {hour12:false})}
td: time.right.reltime(datetime=expireDate.toISOString()) #{expireDate.toLocaleString(undefined, {hourCycle:'h23'})}
td.banposts
if ban.posts && ban.posts.length > 0
| Hover to view

@ -8,7 +8,7 @@ mixin newspost(post, globalmanage=false)
input.left.post-check(type='checkbox', name='checkednews' value=post._id)
a.left(href=`#${post._id}`) #{post.title}
- const newsDate = new Date(post.date);
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hour12:false})}
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hourCycle:'h23'})}
tr
td
if globalmanage === true

@ -40,7 +40,7 @@ mixin post(post, truncate, manage=false, globalmanage=false, ban=false)
span.post-capcode #{post.capcode}
|
- const postDate = new Date(post.date);
time.post-date.reltime(datetime=postDate.toISOString()) #{postDate.toLocaleString(undefined, { hour12:false })}
time.post-date.reltime(datetime=postDate.toISOString()) #{postDate.toLocaleString(undefined, { hourCycle:'h23' })}
|
if post.userId
span.user-id(style=`background-color: #${post.userId}`) #{post.userId}
@ -106,7 +106,7 @@ mixin post(post, truncate, manage=false, globalmanage=false, ban=false)
- const postEditDate = new Date(post.edited.date);
small.cb.mt-5.ml-5.edited
| Last edited
time.reltime(datetime=postEditDate.toISOString()) #{postEditDate.toLocaleString(undefined, { hour12:false })}
time.reltime(datetime=postEditDate.toISOString()) #{postEditDate.toLocaleString(undefined, { hourCycle:'h23' })}
| by #{post.edited.username}
if post.banmessage
p.ban

@ -6,5 +6,5 @@ mixin report(r, manage=false)
a.bold(href=`${manage ? 'recent.html' : ''}?ip=${encodeURIComponent(ip)}`) [#{ip}]
|
- const reportDate = new Date(r.date);
time.reltime(datetime=reportDate.toISOString()) #{reportDate.toLocaleString(undefined, { hour12:false })}
time.reltime(datetime=reportDate.toISOString()) #{reportDate.toLocaleString(undefined, { hourCycle:'h23' })}
| | Reason: #{r.reason}

@ -31,7 +31,7 @@ block content
span.post-capcode #{post.capcode}
|
- const postDate = new Date(post.date);
time.post-date.reltime(datetime=postDate.toISOString()) #{postDate.toLocaleString(undefined, { hour12:false })}
time.post-date.reltime(datetime=postDate.toISOString()) #{postDate.toLocaleString(undefined, { hourCycle:'h23' })}
|
if post.userId
span.user-id(style=`background-color: #${post.userId}`) #{post.userId}

@ -39,7 +39,7 @@ block content
for log in logs
tr
- const logDate = new Date(log.date);
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hour12:false})}
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hourCycle:'h23'})}
td
a(href=`/${log.board}/index.html`) /#{log.board}/
|

@ -26,7 +26,7 @@ block content
p.no-m-p #{`${post.message.raw.substring(0,50)}${post.message.raw.length > 50 ? '...' : ''}`}
td
- const newsDate = new Date(post.date);
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hour12:false})}
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hourCycle:'h23'})}
if boards && boards.length > 0
include ../includes/boardtable.pug

@ -34,7 +34,7 @@ block content
for log in logs
tr
- const logDate = new Date(log.date);
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hour12:false})}
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hourCycle:'h23'})}
td
| #{log.user}
|

@ -23,7 +23,7 @@ block content
for log in logs
tr
- const logDate = new Date(log.date);
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hour12:false})}
td: time.reltime(datetime=logDate.toISOString()) #{logDate.toLocaleString(undefined, {hourCycle:'h23'})}
td(class=(!log.showUser ? 'em' : '')) #{log.showUser ? log.user : 'Hidden User'}
td #{log.actions}
td

Loading…
Cancel
Save