How to use the moment-timezone.updateLocale 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 micromata / projectforge / projectforge-webapp / src / containers / panel / calendar / CalendarPanel.jsx View on Github external
constructor(props) {
        super(props);

        const {
            firstDayOfWeek,
            locale,
            location,
            timeZone,
        } = this.props;

        moment.tz.setDefault(timeZone);
        moment.updateLocale(locale || 'en',
            {
                week: {
                    dow: firstDayOfWeek, // First day of week (got from UserStatus).
                    doy: 1, // First day of year (not yet supported).
                },
            });

        const { defaultDate, defaultView } = props;

        this.state = {
            calendar: '',
            date: defaultDate,
            end: undefined,
            events: undefined,
            loading: false,
            // eslint doesn't recognize the usage in the new 'static getDerivedStateFromProps'
github department-of-veterans-affairs / vets-website / src / platform / site-wide / moment-setup.js View on Github external
'March',
    'April',
    'May',
    'June',
    'July',
    'Aug.',
    'Sept.',
    'Oct.',
    'Nov.',
    'Dec.',
  ],
};

// Called at startup so that the formatting applied under updateLocale occur site-wide.
moment.updateLocale('en', options);
momentTimezone.updateLocale('en', options);
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 polonel / trudesk / src / helpers / hbs / helpers.js View on Github external
calendarDate: function(date) {
        moment.updateLocale('en', {
            calendar: {
                sameDay: '[Today at] LT',
                lastDay: '[Yesterday at] LT',
                nextDay: '[Tomorrow at] LT',
                lastWeek: '[Last] ddd [at] LT',
                nextWeek: 'ddd [at] LT',
                sameElse: 'L'
            }
        });
        return moment.utc(date).tz(global.timezone).calendar();
    },
github OriginProtocol / origin / origin-dapp / src / components / conversation-list-item.js View on Github external
componentWillUnmount() {
    const { modifiedLanguageCode } = this.state
    moment.updateLocale(modifiedLanguageCode, null)
  }
github elastic / kibana / src / core / public / integrations / moment / moment_service.ts View on Github external
const setStartDayOfWeek = (day: string) => {
      const dow = moment.weekdays().indexOf(day);
      moment.updateLocale(moment.locale(), { week: { dow } } as any);
    };
github sw-jung / kibana_notification_center / public / components / notification_center / index.js View on Github external
function setStartDayOfWeek(day) {
        const dow = moment.weekdays().indexOf(day);
        moment.updateLocale(moment.locale(), { week: { dow } });
      }
github 14islands / vecka.14islands.com / public / models / week.js View on Github external
constructor (weekIndex) {
    moment.updateLocale('sv', {
      ordinal: (number) => {
        const b = number % 10
        const output = (~~(number % 100 / 10) === 1) ? 'e'
          : (b === 1) ? 'a'
          : (b === 2) ? 'a'
          : (b === 3) ? 'e' : 'e'
        return number + ':' + output
      }
    })
    moment.locale('sv')
    this.index = weekIndex || 0
    this.current = moment.tz(TIME_ZONE).add(this.index, 'weeks')
    this.startDayOfWeek = this.current.clone().startOf('isoweek')
    this.endDayOfWeek = this.current.clone().endOf('isoweek')
  }
github polonel / trudesk / src / client / containers / Topbar / onlineUserList.jsx View on Github external
static fromNow (timezone, date) {
    if (isUndefined(date)) {
      return 'Never'
    }
    moment.updateLocale('en', {
      relativeTime: {
        future: 'in %s',
        past: '%s ago',
        s: 'a few seconds',
        m: '1m',
        mm: '%dm',
        h: '1h',
        hh: '%dh',
        d: '1d',
        dd: '%dd',
        M: '1mo',
        MM: '%dmos',
        y: '1y',
        yy: '%dyrs'
      }
    })