lib/utils/xml-utils.js
function setDate(node, date, binary) {
    if (date) {
        if (binary) {
            var secondsFrom00 = Math.floor(date.getTime() / 1000) + EpochSeconds;
            var bytes = new DataView(new ArrayBuffer(8));
            var val64 = Int64.from(secondsFrom00);
            bytes.setUint32(0, val64.lo, true);
            bytes.setUint32(4, val64.hi, true);
            setText(node, ByteUtils.bytesToBase64(bytes.buffer));
        } else {
            setText(node, date.toISOString().replace(dateRegex, ''));
        }
    } else {
        setText(node, '');
    }
}
function setDate(node, date, binary) {
    if (date) {
        if (binary) {
            var secondsFrom00 = Math.floor(date.getTime() / 1000) + EpochSeconds;
            var bytes = new DataView(new ArrayBuffer(8));
            var val64 = Int64.from(secondsFrom00);
            bytes.setUint32(0, val64.lo, true);
            bytes.setUint32(4, val64.hi, true);
            setText(node, ByteUtils.bytesToBase64(bytes.buffer));
        } else {
            setText(node, date.toISOString().replace(dateRegex, ''));
        }
    } else {
        setText(node, '');
    }
}
function setDate ( node , date , binary ) { if ( date ) { if ( binary ) { var secondsFrom00 = Math . floor ( date . getTime ( ) / 1000 ) + EpochSeconds ; var bytes = new DataView ( new ArrayBuffer ( 8 ) ) ; var val64 = Int64 . from ( secondsFrom00 ) ; bytes . setUint32 ( 0 , val64 . lo , true ) ; bytes . setUint32 ( 4 , val64 . hi , true ) ; setText ( node , ByteUtils . bytesToBase64 ( bytes . buffer ) ) ; } else { setText ( node , date . toISOString ( ) . replace ( dateRegex , '' ) ) ; } } else { setText ( node , '' ) ; } }
Sets node date as string or binary
@param {Node} node
@param {Date|undefined} date
@param {boolean} [binary=false]
Sets node date as string or binary