Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
} );
if ( ! activeFilter ) {
next();
} else {
if ( currentSite && currentSite.domain ) {
// FIXME: Auto-converted from the Flux setTitle action. Please use instead.
context.store.dispatch( setTitle( i18n.translate( 'Stats', { textOnly: true } ) ) );
}
const gmtOffset = getSiteOption( context.store.getState(), siteId, 'gmt_offset' );
const momentSiteZone = i18n
.moment()
.utcOffset( Number.isFinite( gmtOffset ) ? gmtOffset : 0 );
if ( queryOptions.startDate && i18n.moment( queryOptions.startDate ).isValid() ) {
date = i18n.moment( queryOptions.startDate ).locale( 'en' );
numPeriodAgo = getNumPeriodAgo( momentSiteZone, date, activeFilter.period );
} else {
date = rangeOfPeriod( activeFilter.period, momentSiteZone.locale( 'en' ) ).startOf;
}
numPeriodAgo = parseInt( numPeriodAgo, 10 );
if ( numPeriodAgo ) {
if ( numPeriodAgo > 9 ) {
numPeriodAgo = '10plus';
}
numPeriodAgo = '-' + numPeriodAgo;
} else {
numPeriodAgo = '';
}
export const getOffsetDate = function( date, tz ) {
if ( ! tz ) {
return moment( date );
}
return moment( moment.tz( date, tz ) );
};
function rangeOfPeriod( period, date ) {
date = new i18n.moment( date );
var periodRange = { period: period,
startOf: date.clone().startOf( period ),
endOf: date.clone().endOf( period )
};
if ( 'week' === period ) {
if ( '0' === date.format( 'd' ) ) {
periodRange.startOf.subtract( 6, 'd' );
} else {
periodRange.startOf.add( 1, 'd' );
periodRange.endOf.add( 1, 'd' );
}
}
return periodRange;
}
const BusinessPlanMessage = ( { translate } ) => {
const message = [];
if ( i18n.moment() < thanksgiving2018ClosureStartsAt ) {
message.push(
translate(
"{{p}}Live chat will be closed on Thursday, November 22, 2018 for the US Thanksgiving holiday. If you need to get in touch with us, you’ll be able to submit a support request from this page and we'll respond by email. Live chat will reopen on November 23rd. Thank you!!{{/p}}",
{
components: {
p: <p>,
},
}
)
);
} else {
message.push(
translate(
"{{p}}Live chat is closed today for the US Thanksgiving holiday. If you need to get in touch with us, submit a support request below and we'll respond by email. Live chat will reopen on November 23rd. Thank you!{{/p}}",
{
components: {</p>
transactions = transactions.filter( function( transaction ) {
const date = moment( transaction.date );
if ( params.date.month ) {
return date.isSame( params.date.month, 'month' );
} else if ( params.date.before ) {
return date.isBefore( params.date.before, 'month' );
}
} );
}
function parseDate( transaction ) {
return assign( {}, transaction, {
date: i18n.moment( transaction.date ).toDate()
} );
};
isOutOfDate() {
if ( this.props.plugin && this.props.plugin.last_updated ) {
const lastUpdated = moment( this.props.plugin.last_updated, 'YYYY-MM-DD' );
return moment().diff( lastUpdated, 'years' ) >= this.OUT_OF_DATE_YEARS;
}
return false;
}
const Notice = localize( ( { translate, closedFrom, closedTo, reason } ) => (
<div>
{ title( { translate, closedFrom, closedTo, reason } ) }
<div>
{ i18n.moment().isBefore( closedFrom )
? upcoming( { translate, closedFrom, closedTo, reason } )
: closed( { translate, closedFrom, closedTo, reason } ) }
</div>
</div>
) );
renderJoinDate() {
const { translate } = this.props;
const dateMoment = i18n.moment( user.get().date );
return (
<span>
{
translate( 'Joined %(month)s %(year)s', {
args: {
month: dateMoment.format( 'MMMM' ),
year: dateMoment.format( 'YYYY' )
}
} )
}
</span>
);
},
export const isBackDated = function( post ) {
if ( ! post || ! post.date || ! post.modified ) {
return false;
}
return moment( post.date ).isBefore( moment( post.modified ) );
};