mirror of https://github.com/ElemeFE/element
date-picker: fix you want to add a validity date selector. (#21477)
parent
8ab1db83c5
commit
84cccc5297
|
@ -91,6 +91,7 @@ import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
import Emitter from 'element-ui/src/mixins/emitter';
|
import Emitter from 'element-ui/src/mixins/emitter';
|
||||||
import ElInput from 'element-ui/packages/input';
|
import ElInput from 'element-ui/packages/input';
|
||||||
import merge from 'element-ui/src/utils/merge';
|
import merge from 'element-ui/src/utils/merge';
|
||||||
|
import { t } from 'element-ui/src/locale';
|
||||||
|
|
||||||
const NewPopper = {
|
const NewPopper = {
|
||||||
props: {
|
props: {
|
||||||
|
@ -258,6 +259,9 @@ const TYPE_VALUE_RESOLVER_MAP = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const S_LONG_TERM = new Date(9999, 11, 31).toDateString();
|
||||||
|
|
||||||
const PLACEMENT_MAP = {
|
const PLACEMENT_MAP = {
|
||||||
left: 'bottom-start',
|
left: 'bottom-start',
|
||||||
center: 'bottom',
|
center: 'bottom',
|
||||||
|
@ -276,6 +280,9 @@ const parseAsFormatAndType = (value, customFormat, type, rangeSeparator = '-') =
|
||||||
|
|
||||||
const formatAsFormatAndType = (value, customFormat, type) => {
|
const formatAsFormatAndType = (value, customFormat, type) => {
|
||||||
if (!value) return null;
|
if (!value) return null;
|
||||||
|
|
||||||
|
if (value.toDateString() === S_LONG_TERM) return t('el.datepicker.longTerm');
|
||||||
|
|
||||||
const formatter = (
|
const formatter = (
|
||||||
TYPE_VALUE_RESOLVER_MAP[type] ||
|
TYPE_VALUE_RESOLVER_MAP[type] ||
|
||||||
TYPE_VALUE_RESOLVER_MAP['default']
|
TYPE_VALUE_RESOLVER_MAP['default']
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
datepicker: {
|
datepicker: {
|
||||||
now: '此刻',
|
now: '此刻',
|
||||||
today: '今天',
|
today: '今天',
|
||||||
|
longTerm: '长期',
|
||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
clear: '清空',
|
clear: '清空',
|
||||||
confirm: '确定',
|
confirm: '确定',
|
||||||
|
|
Loading…
Reference in New Issue