~brecht/pamphlets.me

f7c67aa40a2df48bcd96209f61d4f18f3caf32d9 — Brecht Savelkoul a month ago 366096a
Fix bug in client-side timestamp formatting
1 files changed, 3 insertions(+), 2 deletions(-)

M app/static/timestamp.js
M app/static/timestamp.js => app/static/timestamp.js +3 -2
@@ 19,14 19,15 @@ function lang (el) {

function format (el, now) {
  var dt = new Date(offset(el.dateTime))
  var recent = now.getYear() == dt.getYear() && now.getMonth() == dt.getMonth()
  var locale = lang(el)

  var datestring = ''
  var timestring = dt.toLocaleTimeString(locale, timeopts)

  if (now.getDate() - dt.getDate() == 0) {
  if (recent && now.getDate() - dt.getDate() == 0) {
    datestring = 'Today'
  } else if (now.getDate() - dt.getDate() == 1) {
  } else if (recent && now.getDate() - dt.getDate() == 1) {
    datestring = "Yesterday"
  } else {
    datestring = dt.toLocaleDateString(locale, dateopts)