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

format="YYYY-MM-DD HH:mm",日历时分选择框不能显示 #88

Open
sunchens opened this issue Mar 23, 2020 · 3 comments
Open

format="YYYY-MM-DD HH:mm",日历时分选择框不能显示 #88

sunchens opened this issue Mar 23, 2020 · 3 comments

Comments

@sunchens
Copy link

image
只想年月日时分,然后就出现下面的不能选择时分,

@sunchens sunchens changed the title format="YYYY-MM-DD HH:mm",日历不能正常显示 format="YYYY-MM-DD HH:mm",日历时分选择框不能显示 Mar 23, 2020
@webarthur
Copy link

+1

@webarthur
Copy link

webarthur commented May 14, 2020

The issue is located at src/VueDatepickerLocalCalendar.vue:44

  <div :class="`${pre}-foot`" v-if="m==='H'">
    <div :class="`${pre}-hour`">
      <a :title="local.hourTip" @click="showHours=!showHours,showMinutes=showSeconds=false" :class="{on:showHours}">{{hour|dd}}</a>
      <span>:</span>
      <a :title="local.minuteTip" @click="showMinutes=!showMinutes,showHours=showSeconds=false" :class="{on:showMinutes}">{{minute|dd}}</a>
      <span>:</span>
      <a :title="local.secondTip" @click="showSeconds=!showSeconds,showHours=showMinutes=false" :class="{on:showSeconds}">{{second|dd}}</a>
    </div>

And here:

  mounted () {
    const $this = this
    const is = c => $this.format.indexOf(c) !== -1
    if (is('s') && is('m') && (is('h') || is('H'))) {
      $this.m = 'H'
    } else if (is('D')) {
      $this.m = 'D'
    } else if (is('M')) {
      $this.m = 'M'
      $this.showMonths = true
    } else if (is('Y')) {
      $this.m = 'Y'
      $this.showYears = true
    }
  }

@webarthur
Copy link

webarthur commented May 14, 2020

It could be something like:

  <div :class="`${pre}-foot`" v-if="m==='H'">
    <div :class="`${pre}-hour`">
      <a v-if="is('h') || is('H')" :title="local.hourTip" @click="showHours=!showHours,showMinutes=showSeconds=false" :class="{on:showHours}">{{hour|dd}}</a>
      <span v-if="(is('h') || is('H')) && is('m')">:</span>
      <a v-if="is('m')" :title="local.minuteTip" @click="showMinutes=!showMinutes,showHours=showSeconds=false" :class="{on:showMinutes}">{{minute|dd}}</a>
      <span v-if="is('m') && is('s')">:</span>
      <a v-if="is('s')" :title="local.secondTip" @click="showSeconds=!showSeconds,showHours=showMinutes=false" :class="{on:showSeconds}">{{second|dd}}</a>
    </div>

And here:

  mounted () {
    const $this = this
    const is = c => $this.format.indexOf(c) !== -1
    if (is('s') || is('m') || is('h') || is('H')) {
      $this.m = 'H'
    } else if (is('D')) {
      $this.m = 'D'
    } else if (is('M')) {
      $this.m = 'M'
      $this.showMonths = true
    } else if (is('Y')) {
      $this.m = 'Y'
      $this.showYears = true
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants