File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -122,8 +122,9 @@ export function parseDateValue(value: string) {
122122 if ( ! match ) return null ;
123123
124124 const { num, unit } = match . groups ;
125+ const formattedNum = + num > 0 ? + num - 1 : + num ;
125126
126- return { num : + num , unit } ;
127+ return { num : formattedNum , unit } ;
127128}
128129
129130export function parseDateRange ( value : string , locale = 'en-US' ) : DateRange {
@@ -157,12 +158,7 @@ export function parseDateRange(value: string, locale = 'en-US'): DateRange {
157158
158159 const now = new Date ( ) ;
159160 const dateLocale = getDateLocale ( locale ) ;
160- const { unit } = parseDateValue ( value ) ;
161- let { num = 1 } = parseDateValue ( value ) ;
162-
163- if ( value === '7day' ) {
164- num -- ;
165- }
161+ const { num = 1 , unit } = parseDateValue ( value ) ;
166162
167163 switch ( unit ) {
168164 case 'hour' :
You can’t perform that action at this time.
0 commit comments