src/elements/Moment.js
function Moment(value, parameters) {
    abstractions.Element.call(this, utilities.types.MOMENT, parameters);
    var format;
    if (value === undefined || value === null) {
        format = FORMATS[7];
        value = moment.utc();  // the current moment
    } else {
        switch (typeof value) {
            case 'number':
                format = FORMATS[7];
                value = moment.utc(value);  // in milliseconds since EPOC
                break;
            case 'string':
                FORMATS.find(function(candidate) {
                    const attempt = moment.utc(value, candidate, true);  // true means strict mode
                    if (attempt.isValid()) {
                        format = candidate;
                        value = attempt;
                        return true;
                    } 
                    return false;
                });
        }
    }
    if (value.constructor.name !== 'Moment') {
        throw new utilities.Exception({
            $module: '/bali/elements/Moment',
            $procedure: '$Moment',
            $exception: '$invalidParameter',
            $parameter: value.toString(),
            $text: '"An invalid moment value was passed to the constructor."'
        });
    }

    // since this element is immutable the attributes must be read-only
    this.getFormat = function() { return format; };
    this.getValue = function() { return value; };

    return this;
}
function Moment(value, parameters) {
    abstractions.Element.call(this, utilities.types.MOMENT, parameters);
    var format;
    if (value === undefined || value === null) {
        format = FORMATS[7];
        value = moment.utc();  // the current moment
    } else {
        switch (typeof value) {
            case 'number':
                format = FORMATS[7];
                value = moment.utc(value);  // in milliseconds since EPOC
                break;
            case 'string':
                FORMATS.find(function(candidate) {
                    const attempt = moment.utc(value, candidate, true);  // true means strict mode
                    if (attempt.isValid()) {
                        format = candidate;
                        value = attempt;
                        return true;
                    } 
                    return false;
                });
        }
    }
    if (value.constructor.name !== 'Moment') {
        throw new utilities.Exception({
            $module: '/bali/elements/Moment',
            $procedure: '$Moment',
            $exception: '$invalidParameter',
            $parameter: value.toString(),
            $text: '"An invalid moment value was passed to the constructor."'
        });
    }

    // since this element is immutable the attributes must be read-only
    this.getFormat = function() { return format; };
    this.getValue = function() { return value; };

    return this;
}
function Moment ( value , parameters ) { abstractions . Element . call ( this , utilities . types . MOMENT , parameters ) ; var format ; if ( value === undefined || value === null ) { format = FORMATS [ 7 ] ; value = moment . utc ( ) ; // the current moment } else { switch ( typeof value ) { case 'number' : format = FORMATS [ 7 ] ; value = moment . utc ( value ) ; // in milliseconds since EPOC break ; case 'string' : FORMATS . find ( function ( candidate ) { const attempt = moment . utc ( value , candidate , true ) ; // true means strict mode if ( attempt . isValid ( ) ) { format = candidate ; value = attempt ; return true ; } return false ; } ) ; } } if ( value . constructor . name !== 'Moment' ) { throw new utilities . Exception ( { $module : '/bali/elements/Moment' , $procedure : '$Moment' , $exception : '$invalidParameter' , $parameter : value . toString ( ) , $text : '"An invalid moment value was passed to the constructor."' } ) ; } // since this element is immutable the attributes must be read-only this . getFormat = function ( ) { return format ; } ; this . getValue = function ( ) { return value ; } ; return this ; }
PUBLIC CONSTRUCTOR 
This constructor creates a new moment in time using the specified value and parameters.

@param {String|Number} value The source string value of the moment in time.
@param {Parameters} parameters Optional parameters used to parameterize this element.
@returns {Moment} The new moment in time.
PUBLIC CONSTRUCTOR This constructor creates a new moment in time using the specified value and parameters .