fix(utils): Properly export DateUtils.timeZone, fix specs

This commit is contained in:
Juan Tejada 2016-08-01 12:41:05 -07:00
parent 5e2f8756e0
commit 9fe6717a98
4 changed files with 7 additions and 6 deletions

View file

@ -6,7 +6,6 @@ React = require 'react'
DateUtils,
Message,
Event,
Utils,
ComponentRegistry,
EventRSVPTask,
DatabaseStore,
@ -56,11 +55,11 @@ class EventHeader extends React.Component
<div className="event-body">
<div className="event-date">
<div className="event-day">
{moment(@state.event.start*1000).tz(Utils.timeZone).format("dddd, MMMM Do")}
{moment(@state.event.start*1000).tz(DateUtils.timeZone).format("dddd, MMMM Do")}
</div>
<div>
<div className="event-time">
{moment(@state.event.start*1000).tz(Utils.timeZone).format(timeFormat)}
{moment(@state.event.start*1000).tz(DateUtils.timeZone).format(timeFormat)}
</div>
{@_renderEventActions()}
</div>

View file

@ -1,7 +1,7 @@
_ = require 'underscore'
moment = require 'moment-timezone'
React = require 'react'
{DateUtils, Utils} = require 'nylas-exports'
{DateUtils} = require 'nylas-exports'
class MessageTimestamp extends React.Component
@displayName: 'MessageTimestamp'
@ -24,6 +24,6 @@ class MessageTimestamp extends React.Component
onClick={@props.onClick}>{formattedDate}</div>
# Stubbable for testing. Returns a `moment`
_today: -> moment.tz(Utils.timeZone)
_today: -> moment.tz(DateUtils.timeZone)
module.exports = MessageTimestamp

View file

@ -90,6 +90,8 @@ const DateUtils = {
DATE_FORMAT_LLLL_NO_TIME: moment.localeData().longDateFormat("LLLL").replace(/h:mm/, "").replace(" A", ""),
timeZone: tz,
format(momentDate, formatString) {
if (!momentDate) return null;
return momentDate.format(formatString);

@ -1 +1 @@
Subproject commit cb5e582df4c0b29ea7eb2e3d00e8bbd411a22aac
Subproject commit 26d3c7656480044d817e5cda61e6cd7ecd9c4e19