Standardize message-list capitalization to AM/PM,

This commit is contained in:
Sean Collins 2016-01-11 17:23:04 -07:00
parent f212752c1c
commit 1f0ebfca78
2 changed files with 6 additions and 6 deletions
internal_packages/message-list

View file

@ -28,10 +28,10 @@ class MessageTimestamp extends React.Component
diff = now.diff(msgDate, 'days', true)
isSameDay = now.isSame(msgDate, 'days')
if diff < 1 and isSameDay
return msgDate.format "h:mm a"
return msgDate.format "h:mm A"
if diff < 1.5 and not isSameDay
timeAgo = msgDate.from now
monthAndDay = msgDate.format "h:mm a"
monthAndDay = msgDate.format "h:mm A"
return monthAndDay + " (" + timeAgo + ")"
if diff >= 1.5 and diff < 365
return msgDate.format "MMM D"

View file

@ -4,7 +4,7 @@ TestUtils = React.addons.TestUtils
MessageTimestamp = require '../lib/message-timestamp'
msgTime = ->
moment([2010, 1, 14, 15, 25, 50, 125]) # Feb 14, 2010 at 3:25pm
moment([2010, 1, 14, 15, 25, 50, 125]) # Feb 14, 2010 at 3:25 PM
describe "MessageTimestamp", ->
beforeEach ->
@ -23,14 +23,14 @@ describe "MessageTimestamp", ->
it "displays the time from messages shown today", ->
now = msgTime().add(2, 'hours')
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 pm"
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 PM"
it "displays the time from messages yesterday with the relative time if it's less than 36 hours ago", ->
now = msgTime().add(21, 'hours')
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 pm (21 hours ago)"
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 PM (21 hours ago)"
now = msgTime().add(30, 'hours')
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 pm (a day ago)"
expect(@item._formattedDate(msgTime(), now)).toBe "3:25 PM (a day ago)"
it "displays month, day for messages less than a year ago, but more than 24 hours ago", ->
now = msgTime().add(2, 'months')