How Can I Reset to the Initial Value of Slider in D3 JS? I was trying that but When it set Initial Value the Play Button does not work properly

//reset slider functionality code in d3 js
// here we adding event for our resetButton on “click” event it should reset slider to initial value or date or year
resetButton.on(“click”, function () {
if (clearInterval(timer)) {
playButton.text(“Play”);
document.getElementsByClassName(“slider”).value = curDate.setDate(startDate);
} else if (timer = setInterval(step, 500)) {
playButton.text(“Pause”);
document.getElementsByClassName(“slider”).value = curDate.setDate(startDate);
} else {
document.getElementsByClassName(“slider”).value = curDate.setDate(startDate);
}
});