2016-10-06 5 views
1

프로젝트에서 noUiSlider를 사용하려고하는데 도구 설명 안에 날짜 형식을 적용 할 수 없습니다. 방금 외부 부서에 가져 왔습니다.noUiSlider 툴팁의 날짜 형식

JSFIDDLE을보세요.

// Move formatting code into a function 
function toFormat (v) { 
    return formatDate(new Date(v)); 
} 

// Add a formatter to the slider 
format: { to: toFormat, from: Number } 

// You can then directly use the value in the update function 
dateValues[handle].innerHTML = values[handle]; 

fiddle 업데이트 :

noUiSlider.create(dateSlider, { 
    behaviour: 'tap', 
    connect: true, 
    tooltips: [ true, true ], 
    range: { 
     min: timestamp('2016-06-01') + 24 * 60 * 60 * 1000, 
     max: timestamp(date) 
    }, 
    step: 1 * 24 * 60 * 60 * 1000, 
    start: [timestamp(previousMonth), timestamp(date)] 
}); 

답변

6

당신은 format 옵션을 사용할 수 있습니다.