How to use the fulcrum-core.DateUtils.parseISOTimestamp function in fulcrum-core

To help you get started, we’ve selected a few fulcrum-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fulcrumapp / fulcrum-desktop / src / main / models / audio.js View on Github external
updateFromAPIAttributes(attributes) {
    this._id = attributes.access_key;
    this._metadata = attributes.metadata;
    this._fileSize = attributes.file_size;
    this._isUploaded = attributes.uploaded;
    this._isStored = attributes.stored;
    this._isProcessed = attributes.processed;
    this._contentType = attributes.content_type;
    this._hasTrack = !!attributes.track;
    this._trackJSON = attributes.track;
    this._createdByID = attributes.created_by_id;
    this._updatedByID = attributes.updated_by_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
    this._formID = attributes.form_id;
    this._recordID = attributes.record_id;

    this._duration = null;
    this._bitRate = null;

    if (attributes.metadata && attributes.metadata.format) {
      if (attributes.metadata.format.duration != null) {
        this._duration = +attributes.metadata.format.duration;
      }

      if (attributes.metadata.format.bit_rate != null) {
        this._bitRate = +attributes.metadata.format.bit_rate;
      }
    }
github fulcrumapp / fulcrum-desktop / src / main / models / membership.js View on Github external
updateFromAPIAttributes(attrs) {
    const attributes = attrs || {};

    this._id = attributes.id;
    this._firstName = attributes.first_name;
    this._lastName = attributes.last_name;
    this._userID = attributes.user_id;
    this._email = attributes.email;
    this._roleID = attributes.role_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
  }
github fulcrumapp / fulcrum-desktop / src / main / models / photo.js View on Github external
updateFromAPIAttributes(attributes) {
    this._id = attributes.access_key;
    this._exif = attributes.exif;
    this._fileSize = attributes.file_size;
    this._latitude = attributes.latitude;
    this._longitude = attributes.longitude;
    this._isUploaded = attributes.uploaded;
    this._isStored = attributes.stored;
    this._isProcessed = attributes.processed;
    this._contentType = attributes.content_type;
    this._createdByID = attributes.created_by_id;
    this._updatedByID = attributes.updated_by_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
    this._formID = attributes.form_id;
    this._recordID = attributes.record_id;

    if (attributes.exif) {
      const {exif} = attributes;

      this._altitude = exif.gps_altitude;
      this._direction = exif.gps_img_direction;
      this._accuracy = exif.gps_dop;
      this._width = this.integerValue(exif.pixel_x_dimension);
      this._height = this.integerValue(exif.pixel_y_dimension);
      this._make = exif.make;
      this._model = exif.model;
      this._software = exif.software;
      this._dateTime = exif.date_time_original || exif.date_time;
github fulcrumapp / fulcrum-desktop / src / main / sync / tasks / download-resource.js View on Github external
async process(object, attributes) {
    const isChanged = !object.isPersisted ||
                      DateUtils.parseISOTimestamp(attributes.updated_at).getTime() !== object.updatedAt.getTime();

    object.updateFromAPIAttributes(attributes);

    if (object._deletedAt != null) {
      object._deletedAt = null;
    }

    await this.loadObject(object, attributes);

    await object.save();

    if (isChanged) {
      await this.triggerEvent('save', {[this.propertyName]: object});
    }
  }
github fulcrumapp / fulcrum-desktop / src / main / models / signature.js View on Github external
updateFromAPIAttributes(attributes) {
    this._id = attributes.access_key;
    this._fileSize = attributes.file_size;
    this._isUploaded = attributes.uploaded;
    this._isStored = attributes.stored;
    this._isProcessed = attributes.processed;
    this._contentType = attributes.content_type;
    this._createdByID = attributes.created_by_id;
    this._updatedByID = attributes.updated_by_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
    this._formID = attributes.form_id;
    this._recordID = attributes.record_id;
  }
github fulcrumapp / fulcrum-desktop / src / main / models / audio.js View on Github external
updateFromAPIAttributes(attributes) {
    this._id = attributes.access_key;
    this._metadata = attributes.metadata;
    this._fileSize = attributes.file_size;
    this._isUploaded = attributes.uploaded;
    this._isStored = attributes.stored;
    this._isProcessed = attributes.processed;
    this._contentType = attributes.content_type;
    this._hasTrack = !!attributes.track;
    this._trackJSON = attributes.track;
    this._createdByID = attributes.created_by_id;
    this._updatedByID = attributes.updated_by_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
    this._formID = attributes.form_id;
    this._recordID = attributes.record_id;

    this._duration = null;
    this._bitRate = null;

    if (attributes.metadata && attributes.metadata.format) {
      if (attributes.metadata.format.duration != null) {
        this._duration = +attributes.metadata.format.duration;
      }

      if (attributes.metadata.format.bit_rate != null) {
        this._bitRate = +attributes.metadata.format.bit_rate;
      }
    }
  }
github fulcrumapp / fulcrum-desktop / src / main / sync / tasks / download-videos.js View on Github external
async process(object, attributes) {
    const isChanged = !object.isPersisted ||
                      DateUtils.parseISOTimestamp(attributes.updated_at).getTime() !== object.updatedAt.getTime();

    object.updateFromAPIAttributes(attributes);

    if (object.isDownloaded == null) {
      object.isDownloaded = false;
    }

    await this.lookup(object, attributes.form_id, '_formRowID', 'getForm');
    await this.lookup(object, attributes.created_by_id, '_createdByRowID', 'getUser');
    await this.lookup(object, attributes.updated_by_id, '_updatedByRowID', 'getUser');

    if (object._formRowID) {
      const record = await this.account.findFirstRecord({resource_id: attributes.record_id});

      if (record) {
        object._recordRowID = record.rowID;
github fulcrumapp / fulcrum-desktop / src / main / models / photo.js View on Github external
updateFromAPIAttributes(attributes) {
    this._id = attributes.access_key;
    this._exif = attributes.exif;
    this._fileSize = attributes.file_size;
    this._latitude = attributes.latitude;
    this._longitude = attributes.longitude;
    this._isUploaded = attributes.uploaded;
    this._isStored = attributes.stored;
    this._isProcessed = attributes.processed;
    this._contentType = attributes.content_type;
    this._createdByID = attributes.created_by_id;
    this._updatedByID = attributes.updated_by_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
    this._formID = attributes.form_id;
    this._recordID = attributes.record_id;

    if (attributes.exif) {
      const {exif} = attributes;

      this._altitude = exif.gps_altitude;
      this._direction = exif.gps_img_direction;
      this._accuracy = exif.gps_dop;
      this._width = this.integerValue(exif.pixel_x_dimension);
      this._height = this.integerValue(exif.pixel_y_dimension);
      this._make = exif.make;
      this._model = exif.model;
      this._software = exif.software;
      this._dateTime = exif.date_time_original || exif.date_time;
    }
github fulcrumapp / fulcrum-desktop / src / main / models / membership.js View on Github external
updateFromAPIAttributes(attrs) {
    const attributes = attrs || {};

    this._id = attributes.id;
    this._firstName = attributes.first_name;
    this._lastName = attributes.last_name;
    this._userID = attributes.user_id;
    this._email = attributes.email;
    this._roleID = attributes.role_id;
    this._createdAt = DateUtils.parseISOTimestamp(attributes.created_at);
    this._updatedAt = DateUtils.parseISOTimestamp(attributes.updated_at);
  }