Skip to content

Commit

Permalink
refactor(date-picker): move MonthQuarterMap to common
Browse files Browse the repository at this point in the history
  • Loading branch information
kagol committed Feb 29, 2024
1 parent 4875d58 commit ca6384c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 6 additions & 0 deletions packages/renderless/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ export const DATEPICKER = {
2: 6,
3: 9
},
MonthQuarterMap: {
0: 1,
3: 2,
6: 3,
9: 4
},
TriggerTypes: TriggerTypes.split(','),
DateFormats: {
year: 'yyyy',
Expand Down
9 changes: 1 addition & 8 deletions packages/renderless/src/picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,6 @@ const getDatesOfTypeValueResolveMap = (api) => ({
}
})

const MONTH_QUARTER_MAP = {
0: 1,
3: 2,
6: 3,
9: 4
}

export const typeValueResolveMap =
({ api, props, t }) =>
() => ({
Expand All @@ -427,7 +420,7 @@ export const typeValueResolveMap =
number: getNumberOfTypeValueResolveMap(),
dates: getDatesOfTypeValueResolveMap(api),
quarter: {
formatter: (value) => `${value.getFullYear()}-Q${MONTH_QUARTER_MAP[value.getMonth()]}`,
formatter: (value) => `${value.getFullYear()}-Q${DATEPICKER.MonthQuarterMap[value.getMonth()]}`,
parser: api.dateParser
}
})
Expand Down

0 comments on commit ca6384c

Please sign in to comment.