File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/web/src/common/utils/draft Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,19 @@ export const createSomedayDraft = async (
1313 activity : Activity_DraftEvent ,
1414 dispatch : Dispatch ,
1515) => {
16- const startDate = startOfView . format ( YEAR_MONTH_DAY_FORMAT ) ;
17- const endDate = endOfView . format ( YEAR_MONTH_DAY_FORMAT ) ;
16+ let startDate : string ;
17+ let endDate : string ;
18+
19+ if ( category === Categories_Event . SOMEDAY_WEEK ) {
20+ startDate = startOfView . format ( YEAR_MONTH_DAY_FORMAT ) ;
21+ endDate = endOfView . format ( YEAR_MONTH_DAY_FORMAT ) ;
22+ } else {
23+ // Someday month
24+ startDate = startOfView . startOf ( "month" ) . format ( YEAR_MONTH_DAY_FORMAT ) ;
25+ // `endDate` is the last day of the month, hence why we need to use `startOfView`, because
26+ // `endOfView` could be in the next month relative to `startOfView`
27+ endDate = startOfView . endOf ( "month" ) . format ( YEAR_MONTH_DAY_FORMAT ) ;
28+ }
1829
1930 const event = await assembleDefaultEvent ( category , startDate , endDate ) ;
2031
You can’t perform that action at this time.
0 commit comments