我正在使用 Vue2 日期范围选择器(https://innologica.github.io/vue2-daterange-picker/#example-playground)并遇到以下问题
所选日期值显示格式有问题。
问题是,当我选择日期值时,输入按以下格式显示它们:
我想获得选择日期的结果:
Vue组件:
<date-range-picker
ref="picker"
opens="center"
:locale-data="locale"
:maxDate="maxDate"
v-model="dateRange"
@update="update"
>
<div slot="input" slot-scope="picker">{{ dateRange.startDate}} - {{
dateRange.endDate}}</div>
</date-range-picker>
data: () => ({
maxDate: moment().format('YYYY-MM-DD'),
dateRange: {
startDate: moment().format('YYYY-MM-DD'),
endDate: moment().format('YYYY-MM-DD'),
},
locale: {
direction: 'ltr', //direction of text
format: 'mm/dd/yyyy',
separator: ' - ', //separator between the two ranges
applyLabel: 'Apply',
cancelLabel: 'Cancel',
weekLabel: 'W',
customRangeLabel: 'Custom Range',
daysOfWeek: moment.weekdaysMin(), //array of days - see moment documenations for details
monthNames: moment.monthsShort(), //array of …Run Code Online (Sandbox Code Playgroud) date-range vue.js bootstrap-daterangepicker vue-component vuejs2
daterangepicker插件允许使用 setStartDate 和 setEndDate 方法设置日期。是否有任何方法可以在插件中设置时间。
我需要使用 jQuery 和 JavaScript在daterangepicker 中添加时间。我在下面解释我的代码。
<input class="form-control" name="startgroupdate" id="stdate" type="text" placeholder="" onfocus="removeBorder('stdate')">
Run Code Online (Sandbox Code Playgroud)
<input class="form-control" name="startgroupdate" id="stdate" type="text" placeholder="" onfocus="removeBorder('stdate')">
Run Code Online (Sandbox Code Playgroud)
这里只有日期来自日历,但我还需要添加时间,所以结果应该是“03/04/2017 12 10 PM”。
javascript jquery twitter-bootstrap bootstrap-daterangepicker
我正在使用BootStrap Datepicker。我想在字段顶部加载/定位日历。我怎样才能做到这一点 ?
我在几个报告页面上有一个 daterangepicker 控件,我需要修改自定义范围。我需要能够根据当前日期更新自定义范围的标签,以显示当前季度和前 3 个季度的单独范围:
Q1 2018
Q4 2017
Q3 2017
Q2 2017
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚如何传递变量作为显示范围标签的键。这显然行不通:
ranges: {
'This Month': [Date.today().moveToFirstDayOfMonth(), Date.today().moveToLastDayOfMonth()],
'Last Month': [Date.today().moveToFirstDayOfMonth().add({ months: -1 }), Date.today().moveToFirstDayOfMonth().add({ days: -1 })],
cq: [currentQuarter.quarterStartDate, currentQuarter.quarterEndDate],
cm1: [currentM1.quarterStartDate, currentM1.quarterEndDate],
cm2: [currentM2.quarterStartDate, currentM2.quarterEndDate],
cm3: [currentM3.quarterStartDate, currentM3.quarterEndDate],
'Year to Date': [Date.january().moveToFirstDayOfMonth(), Date.december().moveToLastDayOfMonth()],
'Last Year': [Date.january().moveToFirstDayOfMonth().add({ years: -1 }), Date.december().moveToLastDayOfMonth().add({ years: -1 })],
'Default Date': [getDefaultStartDate(), getDefaultEndDate()],
},
Run Code Online (Sandbox Code Playgroud)
它只显示以下范围:
This Month
Last Month
cq
cm1
cm2
cm3
Year to Date
Last Year
Default Date
Run Code Online (Sandbox Code Playgroud)
如何让它显示 cq、cm1、cm2 …