File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Forms/EventForm/SaveSection Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,18 @@ export const MonthSection: FC<Props> = ({
2727} ) => {
2828 const monthLabel = getMonthListLabel ( viewStart ) ;
2929
30+ const currentMonth = new Date ( ) . toLocaleString ( "default" , { month : "long" } ) ;
31+
32+ const isCurrentMonth = monthLabel === currentMonth ;
33+
3034 return (
3135 < SidebarSection >
3236 < SidebarHeader
3337 alignItems = { AlignItems . CENTER }
3438 justifyContent = { JustifyContent . SPACE_BETWEEN }
3539 >
3640 < Text role = "heading" size = "xl" >
37- { monthLabel }
41+ { isCurrentMonth ? "This Month" : monthLabel }
3842 </ Text >
3943 </ SidebarHeader >
4044
Original file line number Diff line number Diff line change @@ -26,14 +26,31 @@ export const WeekSection: FC<Props> = ({
2626 weekLabel,
2727 gridRefs,
2828} ) => {
29+ const isCurrentWeek = ( label : String ) : boolean => {
30+ const [ start , end ] = label . split ( " - " ) ;
31+ const [ month , startDay ] = start . split ( "." ) . map ( Number ) ;
32+ const endDay = Number ( end ) ;
33+ const now = new Date ( ) ;
34+ const year = now . getFullYear ( ) ;
35+
36+ const startDate = new Date ( year , month - 1 , startDay ) ;
37+ const endDate = new Date ( year , month - 1 , endDay ) ;
38+
39+ now . setHours ( 0 , 0 , 0 , 0 ) ;
40+ startDate . setHours ( 0 , 0 , 0 , 0 ) ;
41+ endDate . setHours ( 0 , 0 , 0 , 0 ) ;
42+
43+ return now >= startDate && now <= endDate ;
44+ } ;
45+
2946 return (
3047 < SidebarSection >
3148 < SidebarHeader
3249 alignItems = { AlignItems . CENTER }
3350 justifyContent = { JustifyContent . SPACE_BETWEEN }
3451 >
3552 < Text role = "heading" size = "xl" >
36- { weekLabel }
53+ { isCurrentWeek ( weekLabel ) ? "This Week" : weekLabel }
3754 </ Text >
3855 </ SidebarHeader >
3956
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ export const SaveSection: React.FC<Props> = ({
4141 role = "tab"
4242 tabIndex = { 0 }
4343 title = "Save event"
44- onClick = { _onSubmit }
4544 >
4645 Save
4746 </ StyledSaveBtn >
You can’t perform that action at this time.
0 commit comments