Element date range Selector

choose this ["2018-10-08T16:00:00.000Z", "2018-11-05T16:00:00.000Z"]
can you do this ["2018-10-08", "2018-11-05"]


if you are using the latest version of elementui, there is a format attribute

<el-date-picker
    v-model="value12"
    type="date"
    placeholder=""
    format="yyyy  MM  dd "
    value-format="timestamp">
</el-date-picker>

if this doesn't work, you can get the value and use moment to change the format


<el-date-picker
  v-model="value6"
  type="daterange"
  format="yyyy  MM  dd "
  value-format="yyyy-MM-dd"
  range-separator=""
  start-placeholder=""
  end-placeholder="">
</el-date-picker>

so there is no

clipboard.png


Brother die, what do you think of mine

    <div id="app">
        <div class="block">
            <span class="demonstration"></span>
            {{value6}}
            <el-date-picker v-model="value6" type="daterange" range-separator="" start-placeholder=""
                end-placeholder="" @change='ok'>
            </el-date-picker>
        </div>
    </div>

    <script>
        new Vue({
            el: '-sharpapp',
            data() {
                return {
                    value6: '',
                };
            },
            methods: {
                ok: function (val) {
                    var date1 = this.formatDateTime(val[0])
                    var date2 = this.formatDateTime(val[1])
                    console.log(date1, date2)
                },
                formatDateTime: function (inputTime) {
                    var date = new Date(inputTime);
                    var y = date.getFullYear();
                    var m = date.getMonth() + 1;
                    m = m < 10 ? ('0' + m) : m;
                    var d = date.getDate();
                    d = d < 10 ? ('0' + d) : d;
                    var h = date.getHours();
                    h = h < 10 ? ('0' + h) : h;
                    var minute = date.getMinutes();
                    var second = date.getSeconds();
                    minute = minute < 10 ? ('0' + minute) : minute;
                    second = second < 10 ? ('0' + second) : second;
                    return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
                }
            }
        });
    </script>
Menu