Skip to content

Commit

Permalink
perf: 日期增加week、month、year、quarter类型
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Mar 9, 2023
1 parent f2f9d6e commit 6073b00
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
59 changes: 59 additions & 0 deletions packages/fast-crud/src/types/list/date.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { daterangeFormatter, datetimerangeFormatter } from "../functions";
import { uiContext } from "../../ui";
import dayjs from "dayjs";
import weekOfYear from "dayjs/plugin/weekOfYear";
dayjs.extend(weekOfYear);

export default function () {
const ui = uiContext.get();
Expand Down Expand Up @@ -66,6 +69,62 @@ export default function () {
align: "center",
component: { name: "fs-date-format", format: "HH:mm:ss" }
}
},
month: {
form: {
component: {
//el-date-picker,a-date-picker
...ui.datePicker.buildDateType("month"),
vModel: ui.datePicker.modelValue
}
},
column: {
align: "center",
width: 120,
component: { name: "fs-date-format", format: "YYYY-MM" }
}
},
week: {
form: {
component: {
//el-date-picker,a-date-picker
...ui.datePicker.buildDateType("week"),
vModel: ui.datePicker.modelValue
}
},
column: {
align: "center",
width: 120,
component: { name: "fs-date-format", format: "YYYY-ww[周]" }
}
},
quarter: {
form: {
component: {
//el-date-picker,a-date-picker
...ui.datePicker.buildDateType("quarter"),
vModel: ui.datePicker.modelValue
}
},
column: {
align: "center",
width: 120,
component: { name: "fs-date-format", format: "YYYY-[Q]Q" }
}
},
year: {
form: {
component: {
//el-date-picker,a-date-picker
...ui.datePicker.buildDateType("year"),
vModel: ui.datePicker.modelValue
}
},
column: {
align: "center",
width: 120,
component: { name: "fs-date-format", format: "YYYY" }
}
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import _ from "lodash-es";
import humanizeDuration, { HumanizerOptions } from "humanize-duration";
const defaultOptions = {
language: "zh_CN",
largest: 1
largest: 1,
maxDecimalPoints: 0
};
/**
* 日期人性化格式展示组件
Expand Down

0 comments on commit 6073b00

Please sign in to comment.