Mailspring/internal_packages/thread-list/lib/formatting-utils.cjsx
Ben Gotow 343e592569 feat(draft-list) Refactor thread-list, create draft-list
Summary: Adds the draft list using a refactored list-tabular class. Also fixes several draft bugs that appeared after allowing editing.

Test Plan: Run tests (need to test new ListTabular component ASAP)

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1272
2015-03-09 18:25:53 -07:00

20 lines
456 B
CoffeeScript

moment = require "moment"
React = require 'react'
module.exports =
timestamp: (time) ->
diff = moment().diff(time, 'days', true)
if diff <= 1
format = "h:mm a"
else if diff > 1 and diff <= 365
format = "MMM D"
else
format = "MMM D YYYY"
moment(time).format(format)
subject: (subj) ->
if (subj ? "").trim().length is 0
return <span className="no-subject">(No Subject)</span>
else
return subj