How to use the moment-timezone.months 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');
    const seconds = now.get('second');

    // return time object
    return {
      day,
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;']
github inaturalist / inaturalist / app / webpack / shared / components / torque_map.jsx View on Github external
torqueLayer.on( "change:time", changes => {
      if ( this.props.interval === "weekly" ) {
        $( ".date", domNode ).text(
          moment( ).day( "Monday" ).week( changes.step ).format( "MMM DD" ) );
      } else {
        $( ".date", domNode ).text( moment.months( changes.step ) );
      }
    } );
    torqueLayer.addTo( map );
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;']