extensions/xnat/src/utils/IO/classes/DICOMSEGWriter.js
/**
   * _generateDateTime - Generates a datestamp and timestamp.
   *
   * @returns {object} An object with formatted date and time properties.
   */
Generates a datestamp and timestamp.
@returns {object} An object with formatted date and time properties.
Generates a datestamp and timestamp . @returns { object } An object with formatted date and time properties .
_generateDateTime() {
    const d = new Date();
    const dateTime = {
      year: d.getFullYear().toString(),
      month: (d.getMonth() + 1).toString(),
      date: d.getDate().toString(),
      hours: d.getHours().toString(),
      minutes: d.getMinutes().toString(),
      seconds: d.getSeconds().toString(),
    };
    Object.keys(dateTime).forEach(element => {
      if (dateTime[`${element}`].length < 2) {
        dateTime[`${element}`] = '0' + dateTime[`${element}`];
      }
    });
    return {
      date: dateTime.year + dateTime.month + dateTime.date,
      time: dateTime.hours + dateTime.minutes + dateTime.seconds,
    };
  }
_generateDateTime ( ) { const d = new Date ( ) ; const dateTime = { year : d . getFullYear ( ) . toString ( ) , month : ( d . getMonth ( ) + 1 ) . toString ( ) , date : d . getDate ( ) . toString ( ) , hours : d . getHours ( ) . toString ( ) , minutes : d . getMinutes ( ) . toString ( ) , seconds : d . getSeconds ( ) . toString ( ) , } ; Object . keys ( dateTime ) . forEach ( element => { if ( dateTime [ ` ${ element } ` ] . length < 2 ) { dateTime [ ` ${ element } ` ] = '0' + dateTime [ ` ${ element } ` ] ; } } ) ; return { date : dateTime . year + dateTime . month + dateTime . date , time : dateTime . hours + dateTime . minutes + dateTime . seconds , } ; }
_generateDateTime - Generates a datestamp and timestamp.
_generateDateTime - Generates a datestamp and timestamp .
// Pad with zeros e.g. March: 3 => 03