Use Date object instead of seconds to set valid time of announcement

[MAILPOET-1525]
This commit is contained in:
Rostislav Wolny
2018-09-20 15:24:34 +02:00
parent 54e518e664
commit 3e12ac8928
2 changed files with 5 additions and 3 deletions

View File

@@ -30,7 +30,9 @@ class InAppAnnouncement extends React.Component {
return null;
}
if (this.props.validUntil < (new Date().getTime() / 1000)) {
if (this.props.validUntil !== null
&& this.props.validUntil < new Date()
) {
return null;
}
@@ -80,7 +82,7 @@ InAppAnnouncement.propTypes = {
height: React.PropTypes.string,
className: React.PropTypes.string,
children: React.PropTypes.element.isRequired,
validUntil: React.PropTypes.number,
validUntil: React.PropTypes.instanceOf(Date),
showToNewUser: (props, propName, componentName) => (
validateBooleanWithWindowDependency(props, propName, componentName, 'mailpoet_is_new_user')
),

View File

@@ -24,7 +24,7 @@ const ListingHeading = () => (
showToPremiumUser={false}
showOnlyOnceSlug="free_welcome_emails"
height="650px"
validUntil={new Date('2018-10-31').getTime() / 1000}
validUntil={new Date('2018-10-31')}
>
<div className="mailpoet_in_app_announcement_free_welcome_emails">
<h2>{MailPoet.I18n.t('freeWelcomeEmailsHeading')}</h2>