简体   繁体   中英

Elessar - configuring range slider labels

I would like to use the Elessar library, and configure it to select multiple hour ranges (of a single day). like so:

在此输入图像描述

This kind of looks right, but obviously the "a few seconds" ranges are incorrect. Here is my current configuration:

min: moment([2007, 0, 29]),
max: moment([2007, 0, 30]),
valueFormat: function(ts) {
  return moment(ts).format('LT');
},
valueParse: function(date) {
  return moment(date).valueOf();
},
label: function(a){
  return moment(a[1]).from(a[0], true);
},
snap: 1000 * 60 * 15,
minSize: 1000 * 60 * 60,
barClass: 'progress',
rangeClass: 'bar',
maxRanges: 3,
bgLabels: 12

Any ideas how to fix the range labels?

I think the answer is a little late but....

label: function(a) { 
    var from =  moment(a[0]);
    var until =  moment(a[1]);
    return from.format('HH:mm') + ' to ' + until.format('HH:mm');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM