Skip to content

Commit

Permalink
feat: add prev year
Browse files Browse the repository at this point in the history
  • Loading branch information
xjh22222228 committed Jan 2, 2024
1 parent 2dee2c8 commit b8673a5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/views/capital-flow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ const { Search } = Input
const { RangePicker } = DatePicker
const { Option, OptGroup } = Select

enum FilterType {
const enum FilterType {
Today = 1,
Yesterday,
LastWeek,
ThisYear,
PrevYear,
PrevMonth,
NextMonth
}
Expand All @@ -34,6 +35,7 @@ const cycleTimes = [
{ type: FilterType.Yesterday, name: '昨天' },
{ type: FilterType.LastWeek, name: '最近一周' },
{ type: FilterType.ThisYear, name: '今年' },
{ type: FilterType.PrevYear, name: '上一年' },
{ type: FilterType.PrevMonth, name: '上个月' },
{ type: FilterType.NextMonth, name: '下个月' },
]
Expand Down Expand Up @@ -312,6 +314,23 @@ const CapitalFlowPage: React.FC = function() {
)
break

case FilterType.PrevYear:
date[0] = dayjs(
dayjs(startDate)
.subtract(1, 'y')
.startOf('year')
.format(FORMAT_DATE),
FORMAT_DATE
)
date[1] = dayjs(
dayjs(startDate)
.subtract(1, 'y')
.endOf('year')
.format(FORMAT_DATE),
FORMAT_DATE
)
break

default:
date = []
}
Expand Down

1 comment on commit b8673a5

@vercel
Copy link

@vercel vercel bot commented on b8673a5 Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.