From 37a1a98c49a91c2a6948474b9d8ed8fbebaf5bab Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Thu, 21 Feb 2019 15:39:15 +0300 Subject: [PATCH] Fixed EncryptionTopline check --- client/src/components/ui/EncryptionTopline.js | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/client/src/components/ui/EncryptionTopline.js b/client/src/components/ui/EncryptionTopline.js index 21731219..7c84a847 100644 --- a/client/src/components/ui/EncryptionTopline.js +++ b/client/src/components/ui/EncryptionTopline.js @@ -8,27 +8,29 @@ import Topline from './Topline'; import { EMPTY_DATE } from '../../helpers/constants'; const EncryptionTopline = (props) => { - if (props.notAfter !== EMPTY_DATE) { - const isAboutExpire = isAfter(addDays(Date.now(), 30), props.notAfter); - const isExpired = isAfter(Date.now(), props.notAfter); + if (props.notAfter === EMPTY_DATE) { + return false; + } - if (isExpired) { - return ( - - link]}> - topline_expired_certificate - - - ); - } else if (isAboutExpire) { - return ( - - link]}> - topline_expiring_certificate - - - ); - } + const isAboutExpire = isAfter(addDays(Date.now(), 30), props.notAfter); + const isExpired = isAfter(Date.now(), props.notAfter); + + if (isExpired) { + return ( + + link]}> + topline_expired_certificate + + + ); + } else if (isAboutExpire) { + return ( + + link]}> + topline_expiring_certificate + + + ); } return false;