Sha256: efce7152297c442a6376ebfdeddce16860ff579977cb45f18779dc71b2864638

Contents?: true

Size: 986 Bytes

Versions: 23

Compression:

Stored size: 986 Bytes

Contents

define(
[
    'underscore',
    'backbone'
],
function(
    _,
    Backbone
){

    /**
     * BaseModel
     *
     * Generic model that holds common model methods.
     **/

    var BaseModel = Backbone.Model.extend({
        url : '',
        /**
         * BaseView#formatServerDateTime(value) -> 13 digit timestamp
         * - value (String|Int): Can't rely always rely on date format being given to the front end
         *
         * This is a centralized method simply for detecting the date format from the service architecture,
         * where some systems may use a 13 digit timestamp and others a 10, etc.  This method should make 
         * things easier to change wholesale in the future if needed.
         **/
        formatServerDateTime : function(value) { 
            var serverDateLength = value.toString().length;
            return ( serverDateLength == 10 ) ? ( parseInt(value, 10) * 1000 ) : parseInt(value, 10);
        }
    });

    return BaseModel;
});

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby public/rearview-src/js/model/base.js
rearview-1.2.2.rc.2-jruby public/rearview-src/js/model/base.js
rearview-1.2.2.rc.1-jruby public/rearview-src/js/model/base.js
rearview-1.2.1-jruby public/rearview-src/js/model/base.js
rearview-1.2.0-jruby public/rearview-src/js/model/base.js
rearview-1.1.2-jruby public/rearview-src/js/model/base.js
rearview-1.1.1-jruby public/rearview-src/js/model/base.js
rearview-1.1.0-jruby public/rearview-src/js/model/base.js
rearview-1.0.3.rc.4-jruby public/rearview-src/js/model/base.js
rearview-1.0.3.rc.3-jruby public/rearview-src/js/model/base.js
rearview-1.0.3.rc.2-jruby public/rearview-src/js/model/base.js
rearview-1.0.3.rc.1-jruby public/rearview-src/js/model/base.js
rearview-1.0.2-jruby public/rearview-src/js/model/base.js
rearview-1.0.2.rc.4-jruby public/rearview-src/js/model/base.js
rearview-1.0.2.rc.3-jruby public/rearview-src/js/model/base.js
rearview-1.0.2.rc.2-jruby public/rearview-src/js/model/base.js
rearview-1.0.2.rc.1-jruby public/rearview-src/js/model/base.js
rearview-1.0.1-jruby public/rearview-src/js/model/base.js
rearview-1.0.0-jruby public/rearview-src/js/model/base.js
rearview-1.0.0.rc5-jruby public/rearview-src/js/model/base.js