Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Extract humanize to utils

Tianzhou Chen1af57dfb314c
diff --git a/frontend/src/components/PipelineTable.vue b/frontend/src/components/PipelineTable.vue
index e34dfa1a90..ef8ac8af63 100644
--- a/frontend/src/components/PipelineTable.vue
+++ b/frontend/src/components/PipelineTable.vue
@@ -96,13 +96,13 @@
<script lang="ts">
import { reactive, PropType } from "vue";
import { useRouter } from "vue-router";
-import moment from "moment";
import {
BBTableColumn,
BBTableSectionDataSource,
BBStep,
BBStepStatus,
} from "../bbkit/types";
+import { humanize } from "../utils";
import { Pipeline } from "../types";
interface LocalState {
@@ -211,17 +211,6 @@ export default {
});
};
- const humanize = function (ts: number) {
- const time = moment.utc(ts);
- if (moment().year() == time.year()) {
- if (moment().dayOfYear() == time.dayOfYear()) {
- return time.format("HH:mm");
- }
- return time.format("MMM D");
- }
- return time.format("MMM D YYYY");
- };
-
const clickPipeline = function (section: number, row: number) {
router.push(
`/pipeline/${props.pipelineSectionList[section].list[row].id}`
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
new file mode 100644
index 0000000000..181e76f24e
--- /dev/null
+++ b/frontend/src/utils/index.ts
@@ -0,0 +1 @@
+export * from "./util";
diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts
new file mode 100644
index 0000000000..d3cc7425e4
--- /dev/null
+++ b/frontend/src/utils/util.ts
@@ -0,0 +1,12 @@
+import moment from "moment";
+
+export function humanize(ts: number) {
+ const time = moment.utc(ts);
+ if (moment().year() == time.year()) {
+ if (moment().dayOfYear() == time.dayOfYear()) {
+ return time.format("HH:mm");
+ }
+ return time.format("MMM D");
+ }
+ return time.format("MMM D YYYY");
+}