diff --git a/components/common/InfoDateAllert.tsx b/components/common/InfoDateAllert.tsx new file mode 100644 index 0000000..906aae0 --- /dev/null +++ b/components/common/InfoDateAllert.tsx @@ -0,0 +1,23 @@ +interface IProps { + text: string; + date: string; +} + +const InfoDateAllert = ({ text, date }: IProps) => { + function formatDate(dateTimeString: string) { + const [datePart] = dateTimeString.split(' '); + const [year, month, day] = datePart.split('-'); + return `${day}-${month}-${year}`; + } + + const readyDate = formatDate(date); + + return ( +
+ {text} + {readyDate} +
+ ); +}; + +export default InfoDateAllert;