File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/pages/events/components Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import { cva, type VariantProps } from 'class-variance-authority';
44import { cn } from '@/shared/lib' ;
55
66interface DateTagProps extends VariantProps < typeof dateTagStyle > {
7- startDate : string ;
8- endDate : string ;
7+ startDate ? : string ;
8+ endDate ? : string ;
99 className ?: string ;
1010}
1111
@@ -26,7 +26,13 @@ export default function DateTag({
2626 endDate,
2727 className,
2828} : DateTagProps ) {
29- const formatDate = ( date : string ) => date . replace ( / - / g, '.' ) ;
29+ const formatDate = ( date ?: string ) => {
30+ if ( ! date ) return '' ;
31+ return date . replace ( / - / g, '.' ) ;
32+ } ;
33+
34+ if ( ! startDate && ! endDate ) return null ;
35+
3036 return (
3137 < div className = { cn ( dateTagStyle ( ) , className ) } >
3238 { formatDate ( startDate ) } ~ { formatDate ( endDate ) }
You can’t perform that action at this time.
0 commit comments