import moment from 'moment'; const expiryDate = '03-21-2023'; const currentDate = moment(); // Parse the expiry date using Moment.js const parsedExpiryDate = moment(expiryDate, 'MM-DD-YYYY'); // Compare the expiry date to the current date to check if the token is expired if (parsedExpiryDate.isBefore(currentDate)) { console.log('Token has expired!'); } else { console.log('Token is still valid'); }