How to use the moment-timezone.weekdays 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 amine7536 / react-clockwall / src / components / Clock.js View on Github external
getMoment(timezone, locale) {
    moment.locale(locale);
    const now = moment().tz(timezone);
    const tz = moment().tz(timezone).format('z');

    // Day
    const weekdays = moment.weekdays();
    const dayName = weekdays[now.get('day')];
    const day = now.get('date');

    // Month
    const months = moment.months();
    const monthName = months[now.month()];
    const month = now.get('month');

    // Year
    const year = now.get('year');

    // Time
    let hours = now.get('hour');
    const meridiem = (hours < 12) ? 'AM' : 'PM';
    hours = (this.props.config.meridiem && meridiem === 'PM') ? (hours - 12) : hours;
    const minutes = now.get('minute');
github epam / cloud-pipeline / client / src / components / runs / run-scheduling / run-sheduling-list.js View on Github external
      : `on ${dayOfWeek.sort().map((day) => moment.weekdays(false, +day)).join(', ')}`;
github epam / cloud-pipeline / client / src / components / runs / run-scheduling / run-scheduling-dialog.js View on Github external
}
    };

    return (
      <div style="{{flex:">
        <select style="{{width:" size="small" value="{schedule.dayOfWeek" mode="multiple" disabled="{removed}">
          {
            moment
              .weekdays(false)
              .map((day, id) =&gt; ({day}))
          }
        </select>
      </div>
    );
  };
github CroudTech / Croud-Style-Guide / src / components / shared / mixins / schedule.js View on Github external
getSchedule() {
            const root = cloneDeep(this.rootObject)
            const frequency = root['service=scheduler;table=timetables;field=frequency;'] ? root['service=scheduler;table=timetables;field=frequency;'] : {}

            const months = {}
            moment.months().forEach((key) => { months[key.toLowerCase()] = false })
            if (frequency && frequency.months) frequency.months.forEach((key) => { months[key] = true })

            const days = {}
            moment.weekdays().forEach((key) => { days[key.toLowerCase()] = false })
            if (frequency && frequency.days) frequency.days.forEach((key) => { days[key] = true })

            const freq = {
                days,
                months,
                at: frequency.at ? frequency.at[0] : '00:00',
                recur: frequency.recur || 'daily',
                timezone: frequency.timezone || 'Europe/London',
            }

            const startsAt = root['service=scheduler;table=timetables;field=starts_at;']
            const endsAt = root['service=scheduler;table=timetables;field=ends_at;']

            const limit = {}
            limit.startsAt = startsAt ? moment(startsAt, 'YYYY-MM-DD hh:mm:ss').format('YYYY-MM-DD hh:mm:ss') : ''
            limit.endsAt = endsAt ? moment(endsAt, 'YYYY-MM-DD hh:mm:ss').format('YYYY-MM-DD hh:mm:ss') : ''
github elastic / kibana / src / ui / public / autoload / settings.js View on Github external
function setStartDayOfWeek(day) {
  const dow = moment.weekdays().indexOf(day);
  moment.updateLocale(moment.locale(), { week: { dow } });
}
github CroudTech / Croud-Style-Guide / src / components / shared / scheduler / SchedulerEditor.vue View on Github external
getSchedule() {
                const root = cloneDeep(this.rootObject)
                const frequency = root['service=scheduler;table=timetables;field=frequency;'] ? root['service=scheduler;table=timetables;field=frequency;'] : {}

                const months = {}
                moment.months().forEach((key) => { months[key.toLowerCase()] = false })
                if (frequency && frequency.months) frequency.months.forEach((key) => { months[key] = true })

                const days = {}
                moment.weekdays().forEach((key) => { days[key.toLowerCase()] = false })
                if (frequency && frequency.days) frequency.days.forEach((key) => { days[key] = true })

                const freq = {
                    days,
                    months,
                    at: frequency.at ? frequency.at[0] : '00:00',
                    recur: frequency.recur || 'daily',
                    timezone: frequency.timezone || 'Europe/London',
                }

                const startsAt = root['service=scheduler;table=timetables;field=starts_at;']
                const endsAt = root['service=scheduler;table=timetables;field=ends_at;']

                const limit = {}
                limit.startsAt = startsAt ? moment(startsAt, 'YYYY-MM-DD hh:mm:ss').format('YYYY-MM-DD hh:mm:ss') : ''
                limit.endsAt = endsAt ? moment(endsAt, 'YYYY-MM-DD hh:mm:ss').format('YYYY-MM-DD hh:mm:ss') : ''
github freenas / gui / ui / sections / system / inspectors / language-and-region.reel / language-and-region.js View on Github external
this._sectionService.getSystemGeneral().then(function(systemGeneral) {
                        self.generalData = systemGeneral;
                        self._snapshotDataObjectsIfNecessary();
                    })
                ]).then(function() {
                    self.isLoading = false;
                });
                var today = new Date();
                this.dateFormatShortOptions = this.generateDateFormatConvertedList(today, this.shortDateFormats);
                this.dateFormatMediumOptions = this.generateDateFormatConvertedList(today, this.mediumDateFormats);
                this.dateFormatLongOptions = this.generateDateFormatConvertedList(today, this.longDateFormats);
                this.dateFormatFullOptions = this.generateDateFormatConvertedList(today, this.fullDateFormats);
                this.timeFormatShortOptions = this.generateDateFormatConvertedList(today, this.shortTimeFormats);
                this.timeFormatMediumOptions = this.generateDateFormatConvertedList(today, this.mediumTimeFormats);
                this.timeFormatLongOptions = this.generateDateFormatConvertedList(today, this.longTimeFormats);
                this.firstDayOfWeekOptions = _.map(moment.weekdays(), function(day, index) {
                    return {
                        label: day,
                        value: index
                    };
                });
            }
        }
    },