= ({
const getBotsTokenExpiryDate = () => {
if (botsTokenExpiry) {
+ // get the current date timestamp
+ const currentTimeStamp = Date.now();
+
+ const isTokenExpired = currentTimeStamp >= Number(botsTokenExpiry);
+
+ // get the token expiry date
+ const tokenExpiryDate =
+ moment(botsTokenExpiry).format('ddd Do MMMM, YYYY');
+
return (
- Expires on {moment(botsTokenExpiry).format('ddd Do MMMM, YYYY')}
+ {isTokenExpired
+ ? `Expired on ${tokenExpiryDate}`
+ : `Expires on ${tokenExpiryDate}`}
+ .
);
} else {
- return null;
+ return (
+
+
+
+ This token has no expiration date.
+
+
+ );
}
};