2016-10-06 15 views
1

プロジェクトでnoUiSliderを使用しようとしていますが、ツールチップ内に日付フォーマットを適用できません。私はちょうどそれを外部部門に持っていた。noUiSliderツールチップの日付フォーマット

このJSFIDDLEをご覧ください。 fiddleを更新しました

// 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]; 

:あなたはformatオプションを使用することができます

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)] 
}); 

答えて

関連する問題