example/timeline-notches/main.js
function formatTimeCallback(seconds, pxPerSec) {
    seconds = Number(seconds);
    var minutes = Math.floor(seconds / 60);
    seconds = seconds % 60;

    // fill up seconds with zeroes
    var secondsStr = Math.round(seconds).toString();
    if (pxPerSec >= 25 * 10) {
        secondsStr = seconds.toFixed(2);
    } else if (pxPerSec >= 25 * 1) {
        secondsStr = seconds.toFixed(1);
    }

    if (minutes > 0) {
        if (seconds < 10) {
            secondsStr = '0' + secondsStr;
        }
        return `${minutes}:${secondsStr}`;
    }
    return secondsStr;
}
function formatTimeCallback(seconds, pxPerSec) {
    seconds = Number(seconds);
    var minutes = Math.floor(seconds / 60);
    seconds = seconds % 60;

    // fill up seconds with zeroes
    var secondsStr = Math.round(seconds).toString();
    if (pxPerSec >= 25 * 10) {
        secondsStr = seconds.toFixed(2);
    } else if (pxPerSec >= 25 * 1) {
        secondsStr = seconds.toFixed(1);
    }

    if (minutes > 0) {
        if (seconds < 10) {
            secondsStr = '0' + secondsStr;
        }
        return `${minutes}:${secondsStr}`;
    }
    return secondsStr;
}
function formatTimeCallback ( seconds , pxPerSec ) { seconds = Number ( seconds ) ; var minutes = Math . floor ( seconds / 60 ) ; seconds = seconds % 60 ; // fill up seconds with zeroes var secondsStr = Math . round ( seconds ) . toString ( ) ; if ( pxPerSec >= 25 * 10 ) { secondsStr = seconds . toFixed ( 2 ) ; } else if ( pxPerSec >= 25 * 1 ) { secondsStr = seconds . toFixed ( 1 ) ; } if ( minutes > 0 ) { if ( seconds < 10 ) { secondsStr = '0' + secondsStr ; } return ` ${ minutes } ${ secondsStr } ` ; } return secondsStr ; }
Use formatTimeCallback to style the notch labels as you wish, such
as with more detail as the number of pixels per second increases.

Here we format as M:SS.frac, with M suppressed for times < 1 minute,
and frac having 0, 1, or 2 digits as the zoom increases.

Note that if you override the default function, you'll almost
certainly want to override timeInterval, primaryLabelInterval and/or
secondaryLabelInterval so they all work together.

@param: seconds
@param: pxPerSec
Use formatTimeCallback to style the notch labels as you wish such as with more detail as the number of pixels per second increases .