date-picker: fix you want to add a validity date selector. (#21477)

pull/21988/head
MrXhh 2022-07-11 16:27:43 +08:00
parent 8ab1db83c5
commit 84cccc5297
2 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,7 @@ import Popper from 'element-ui/src/utils/vue-popper';
import Emitter from 'element-ui/src/mixins/emitter';
import ElInput from 'element-ui/packages/input';
import merge from 'element-ui/src/utils/merge';
import { t } from 'element-ui/src/locale';
const NewPopper = {
props: {
@ -258,6 +259,9 @@ const TYPE_VALUE_RESOLVER_MAP = {
}
}
};
const S_LONG_TERM = new Date(9999, 11, 31).toDateString();
const PLACEMENT_MAP = {
left: 'bottom-start',
center: 'bottom',
@ -276,6 +280,9 @@ const parseAsFormatAndType = (value, customFormat, type, rangeSeparator = '-') =
const formatAsFormatAndType = (value, customFormat, type) => {
if (!value) return null;
if (value.toDateString() === S_LONG_TERM) return t('el.datepicker.longTerm');
const formatter = (
TYPE_VALUE_RESOLVER_MAP[type] ||
TYPE_VALUE_RESOLVER_MAP['default']

View File

@ -7,6 +7,7 @@ export default {
datepicker: {
now: '此刻',
today: '今天',
longTerm: '长期',
cancel: '取消',
clear: '清空',
confirm: '确定',