Skip to content

Commit

Permalink
fix: resolve timeFormat (#4505)
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 authored Aug 28, 2024
1 parent e59b695 commit 0a2e50e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 47 files
+41 −0 docs/mobile/api/action-sheet.en-US.md
+8 −0 docs/mobile/api/action-sheet.md
+19 −0 docs/mobile/api/badge.en-US.md
+5 −5 docs/mobile/api/badge.md
+66 −0 docs/mobile/api/button.en-US.md
+34 −5 docs/mobile/api/button.md
+36 −0 docs/mobile/api/collapse.en-US.md
+18 −3 docs/mobile/api/collapse.md
+21 −0 docs/mobile/api/count-down.en-US.md
+8 −3 docs/mobile/api/count-down.md
+35 −0 docs/mobile/api/grid.en-US.md
+18 −2 docs/mobile/api/grid.md
+29 −0 docs/mobile/api/image.en-US.md
+11 −17 docs/mobile/api/image.md
+64 −0 docs/mobile/api/input.en-US.md
+40 −12 docs/mobile/api/input.md
+17 −0 docs/mobile/api/link.en-US.md
+15 −0 docs/mobile/api/link.md
+45 −0 docs/mobile/api/loading.en-US.md
+14 −12 docs/mobile/api/loading.md
+31 −0 docs/mobile/api/search.en-US.md
+19 −5 docs/mobile/api/search.md
+25 −0 docs/mobile/api/side-bar.en-US.md
+25 −0 docs/mobile/api/side-bar.md
+41 −0 docs/mobile/api/tab-bar.en-US.md
+22 −10 docs/mobile/api/tab-bar.md
+21 −0 docs/mobile/api/table.en-US.md
+21 −0 docs/mobile/api/table.md
+25 −0 docs/mobile/api/toast.en-US.md
+7 −17 docs/mobile/api/toast.md
+4 −0 docs/web/api/empty.en-US.md
+4 −0 docs/web/api/empty.md
+1 −1 js/time-picker/const.ts
+37 −0 js/time-picker/utils.ts
+10 −10 style/mobile/components/_index.less
+11 −11 style/mobile/components/badge/v2/_index.less
+40 −2 style/mobile/components/button/v2/_index.less
+8 −0 style/mobile/components/button/v2/_var.less
+44 −0 style/mobile/components/image/v2/_index.less
+10 −5 style/mobile/components/link/_index.less
+61 −15 style/mobile/components/link/_var.less
+8 −0 style/mobile/components/loading/_index.less
+1 −1 style/mobile/components/overlay/v2/_index.less
+14 −0 style/mobile/utilities/_animation.less
+29 −0 style/web/components/empty/_index.less
+10 −5 style/web/components/empty/_var.less
+78 −0 test/unit/time-picker/utils.test.js
27 changes: 3 additions & 24 deletions src/time-picker/panel/single-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';

import { panelColProps } from './props';
import {
EPickerCols,
TWELVE_HOUR_FORMAT,
TIME_FORMAT,
AM,
PM,
MERIDIEM_LIST,
} from '../../_common/js/time-picker/const';
import { closestLookup } from '../../_common/js/time-picker/utils';
import { EPickerCols, TWELVE_HOUR_FORMAT, AM, PM, MERIDIEM_LIST } from '../../_common/js/time-picker/const';
import { closestLookup, getPickerCols } from '../../_common/js/time-picker/utils';
import { useCommonClassName, useConfig, usePrefixClass } from '../../hooks/useConfig';

dayjs.extend(customParseFormat);
Expand Down Expand Up @@ -79,21 +72,7 @@ export default defineComponent({
);

onMounted(() => {
const match = format.value.match(TIME_FORMAT);

const [, startCol, hourCol, minuteCol, secondCol, milliSecondCol, endCol] = match;
const { meridiem, hour, minute, second, milliSecond } = EPickerCols;

const renderCol = [
startCol && meridiem,
hourCol && hour,
minuteCol && minute,
secondCol && second,
milliSecondCol && milliSecond,
endCol && meridiem,
].filter((v) => !!v);

cols.value = renderCol;
cols.value = getPickerCols(format.value);
});

// 获取每个时间的高度
Expand Down

0 comments on commit 0a2e50e

Please sign in to comment.