Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datepicker): 修复空字符串页面崩溃问题 #1453

Merged
merged 3 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useGlobalIcon } from '../hooks/useGlobalIcon';
import useSingle from './hooks/useSingle';
import {
parseToDayjs, getDefaultFormat, formatTime, formatDate,
} from './hooks/useFormat';
} from '../_common/js/date-picker/format';
import { subtractMonth, addMonth, extractTimeObj } from '../_common/js/date-picker/utils';
import type { DateValue } from './type';
import props from './props';
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/DatePickerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineComponent, computed } from '@vue/composition-api';
import dayjs from 'dayjs';

import useSingleValue from './hooks/useSingleValue';
import { formatDate, getDefaultFormat } from './hooks/useFormat';
import { formatDate, getDefaultFormat } from '../_common/js/date-picker/format';
import { subtractMonth, addMonth, extractTimeObj } from '../_common/js/date-picker/utils';
import type {
DateValue,
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import useRange from './hooks/useRange';
import { initYearMonthTime } from './hooks/useRangeValue';
import {
parseToDayjs, formatTime, formatDate, isValidDate, getDefaultFormat,
} from './hooks/useFormat';
} from '../_common/js/date-picker/format';
import { subtractMonth, addMonth, extractTimeObj } from '../_common/js/date-picker/utils';

export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/DateRangePickerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

import TRangePanel from './panel/RangePanel';
import useRangeValue from './hooks/useRangeValue';
import { formatDate, getDefaultFormat } from './hooks/useFormat';
import { formatDate, getDefaultFormat } from '../_common/js/date-picker/format';
import { subtractMonth, addMonth, extractTimeObj } from '../_common/js/date-picker/utils';

export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/base/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineComponent, PropType, computed } from '@vue/composition-api';
import TDatePickerCell from './Cell';
import { useConfig, usePrefixClass } from '../../hooks/useConfig';
import type { TdDatePickerProps } from '../type';
import { parseToDayjs } from '../hooks/useFormat';
import { parseToDayjs } from '../../_common/js/date-picker/format';

export default defineComponent({
name: 'TDatePickerTable',
Expand Down
194 changes: 0 additions & 194 deletions src/date-picker/hooks/useFormat.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/date-picker/hooks/useRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dayjs from 'dayjs';
import { usePrefixClass, useConfig } from '../../hooks/useConfig';

import { TdDateRangePickerProps, DateValue } from '../type';
import { isValidDate, formatDate, getDefaultFormat } from './useFormat';
import { isValidDate, formatDate, getDefaultFormat } from '../../_common/js/date-picker/format';
import useRangeValue from './useRangeValue';

export const PARTIAL_MAP = { first: 'start', second: 'end' };
Expand Down
8 changes: 6 additions & 2 deletions src/date-picker/hooks/useRangeValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import useVModel from '../../hooks/useVModel';

import { TdDateRangePickerProps, DateRangeValue } from '../type';
import {
isValidDate, formatDate, formatTime, getDefaultFormat, parseToDayjs,
} from './useFormat';
isValidDate,
formatDate,
formatTime,
getDefaultFormat,
parseToDayjs,
} from '../../_common/js/date-picker/format';
import { extractTimeFormat } from '../../_common/js/date-picker/utils';

export const PARTIAL_MAP = { first: 'start', second: 'end' };
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/hooks/useSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { usePrefixClass, useConfig } from '../../hooks/useConfig';
import { TdDatePickerProps, DateValue } from '../type';
import {
isValidDate, formatDate, formatTime, getDefaultFormat,
} from './useFormat';
} from '../../_common/js/date-picker/format';
import useSingleValue from './useSingleValue';

export default function useSingle(props: TdDatePickerProps, { emit }: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/hooks/useSingleValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
import dayjs from 'dayjs';
import {
formatDate, formatTime, isValidDate, getDefaultFormat,
} from './useFormat';
} from '../../_common/js/date-picker/format';
import useVModel from '../../hooks/useVModel';
import { TdDatePickerProps } from '../type';
import { extractTimeFormat } from '../../_common/js/date-picker/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/panel/PanelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { TdDatePickerProps } from '../type';
import TDateHeader from '../base/Header';
import TDateTable from '../base/Table';
import TTimePickerPanel from '../../time-picker/panel/time-picker-panel';
import { getDefaultFormat } from '../hooks/useFormat';
import { getDefaultFormat } from '../../_common/js/date-picker/format';

export default defineComponent({
name: 'TPanelContent',
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/panel/RangePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useConfig, usePrefixClass } from '../../hooks/useConfig';
import TPanelContent from './PanelContent';
import TExtraContent from './ExtraContent';
import { TdDateRangePickerProps } from '../type';
import { getDefaultFormat, parseToDayjs } from '../hooks/useFormat';
import { getDefaultFormat, parseToDayjs } from '../../_common/js/date-picker/format';
import useTableData from '../hooks/useTableData';
import useDisableDate from '../hooks/useDisableDate';

Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/panel/SinglePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useConfig, usePrefixClass } from '../../hooks/useConfig';
import TPanelContent from './PanelContent';
import TExtraContent from './ExtraContent';
import { TdDatePickerProps } from '../type';
import { getDefaultFormat, parseToDayjs } from '../hooks/useFormat';
import { getDefaultFormat, parseToDayjs } from '../../_common/js/date-picker/format';
import useTableData from '../hooks/useTableData';
import useDisableDate from '../hooks/useDisableDate';

Expand Down
Loading