element [Feature Request] DatePicker change erroneous user format

rbl8hiat  于 2022-11-02  发布在  其他
关注(0)|答案(3)|浏览(182)

Existing Component

Yes

Component Name

DatePicker

Description

Hi,
I am using the latest version of the library.
Attributes: value-format = 'yyyy-MM-dd'

Sometimes users enter from the keyboard and make mistakes with a separator. How can I process the entered data? onChange does not work.

i5desfxk

i5desfxk1#

@YaProof I'm looking into a similar issue and noticed that if you bind a method to @change.native , then you can access the user's input and manipulate it.

Example:

<el-date-picker v-model="value1" @change.native="method1"></el-date-picker>
...
methods: {
  method1(e) {
   // e.target.value contains the user's input
  }
}

My issue is that in Element version 2.7, Element automatically converted 01012020 to 01/01/2020, but as of 2.13 it does not any more....

mctunoxg

mctunoxg2#

@freeman-g Thanks, this will solve my problem.

3z6pesqy

3z6pesqy3#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题