How to use the moment-timezone.ISO_8601 function in moment-timezone

To help you get started, we’ve selected a few moment-timezone 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 NLeSC / spot / framework / dataset / client.js View on Github external
values.forEach(function (value) {
      if (moment(value, moment.ISO_8601).isValid()) {
        // "2016-08-17 17:25:00+01"
        mytype.datetime++;
      } else if (
          (moment.duration(value).asMilliseconds() !== 0) &&
          (typeof value === 'string') &&
          (value[0].toLowerCase() === 'p')) {
        // "P10Y"
        mytype.duration++;
      } else if (value == +value) {  // eslint-disable-line eqeqeq
        // "10" or 10
        mytype.continuous++;
      } else {
        // "hello world"
        mytype.categorial++;
      }
    });
github NLeSC / spot / src / widgets / models / barchart.js View on Github external
parser: function (label) {
                return moment(label, moment.ISO_8601);
              }
            }
github NLeSC / spot / src / widgets / models / horizontalbarchart.js View on Github external
parser: function (label) {
                return moment(label, moment.ISO_8601);
              }
            }
github swimlane / ngx-ui / projects / swimlane / ngx-ui / src / lib / components / date-time / date-time.component.ts View on Github external
@Input() id: string = `datetime-${++nextId}`;
  @Input() name: string;
  @Input() disabled: boolean;
  @Input() tabindex: number;
  @Input() autofocus: boolean = false;

  @Input() label: string;
  @Input() hint: string;
  @Input() placeholder: string = '';

  @Input() minDate: string | Date;
  @Input() maxDate: string | Date;
  @Input() precision: moment.unitOfTime.StartOf;

  @Input() timezone: string;
  @Input() inputFormats: any[] = ['L', `LT`, 'L LT', moment.ISO_8601];

  @Input()
  get inputType(): string {
    if (!this._inputType) {
      return DateTimeType.date;
    }
    return this._inputType;
  }
  set inputType(val: string) {
    this._inputType = val;
    this.displayValue = this.getDisplayValue();
  }

  @Input()
  get format(): string {
    if (!this._format) {
github artsy / emission / src / lib / Components / Bidding / Components / Timer.tsx View on Github external
formatDate(date: string) {
    const dateInMoment = moment(date, moment.ISO_8601).tz(moment.tz.guess(true))
    const format = dateInMoment.minutes() === 0 ? "MMM D, h A" : "MMM D, h:mm A"

    return dateInMoment.format(format)
  }
github staeco / iris-ql / src / types / index.js View on Github external
  check: (v) => moment(v, moment.ISO_8601).isValid(),
  hydrate: (txt) => types.fn('parse_iso', txt)
github godmodelabs / flora / lib / cast.js View on Github external
const apiTz = api && api.config && api.config.timezone ? api.config.timezone : 'UTC';
    const defaultStoredTz =
        api && api.config && api.config.defaultStoredTimezone ? api.config.defaultStoredTimezone : apiTz;

    const storedTz =
        options && options.storedType && options.storedType.options && options.storedType.options.timezone
            ? options.storedType.options.timezone
            : defaultStoredTz;

    if (!moment.tz.zone(storedTz)) throw new ImplementationError(`Invalid timezone: "${storedTz}"`);

    let m;
    if (options && options.storedType && options.storedType.type === 'unixtime') {
        m = moment(parseInt(value, 10), 'X');
    } else {
        m = moment.tz(value, moment.ISO_8601, true, storedTz);
    }

    if (!m.isValid()) throw new DataError('Invalid date format');

    return m;
}
github Graylog2 / graylog2-server / javascript / src / legacy / moment-helper.js View on Github external
_getAcceptedFormats: function() {
        return [
            momentHelper.DATE_FORMAT_TZ,
            momentHelper.DATE_FORMAT_TZ_NO_MS,
            moment.ISO_8601,
            momentHelper.DATE_FORMAT,
            momentHelper.DATE_FORMAT_NO_MS
        ];
    },
github Picolab / pico-engine / packages / node-pico-engine-core / src / modules / time.js View on Github external
var parse = function(str){
        return parse_utc
            ? moment.utc(str, moment.ISO_8601)
            : moment(str, moment.ISO_8601);
    };
    var d = parse(date_str);
github bravetechnologycoop / BraveButtons / chatbot / server.js View on Github external
}

    try {
        let recentSessions = await db.getRecentSessionsWithInstallationId(req.params.installationId)
        let currentInstallation = await db.getInstallationWithInstallationId(req.params.installationId)
        let allInstallations = await db.getInstallations()
        
        let viewParams = {
            recentSessions: [],
            currentInstallationName: currentInstallation.name,
            installations: allInstallations.map(installation => { return { name: installation.name, id: installation.id }})
        }

        for(const recentSession of recentSessions) {
            let createdAt = moment(recentSession.createdAt, moment.ISO_8601)
            let updatedAt = moment(recentSession.updatedAt, moment.ISO_8601)
            viewParams.recentSessions.push({
                unit: recentSession.unit,
                createdAt: createdAt.tz('America/Vancouver').format('DD MMM Y, hh:mm:ss A'),
                updatedAt: updatedAt.tz('America/Vancouver').format('DD MMM Y, hh:mm:ss A'),
                state: recentSession.state,
                numPresses: recentSession.numPresses.toString(),
                incidentType: recentSession.incidentType,
                notes: recentSession.notes
            })
        }
        
        for(let i=0; i