Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngOnInit() {
this.lightCards$ = this.store.pipe(
select(feedSelectors.selectFilteredFeed),
catchError(err => of([]))
);
this.selection$ = this.store.select(feedSelectors.selectLightCardSelection);
this.store.select(buildConfigSelector('feed.timeline.hide'))
.subscribe(v=>this.hideTimeLine = v);
moment.updateLocale('en', { week: {
dow: 6, // First day of week is Saturday
doy: 12 // First week of year must contain 1 January (7 + 6 - 1)
}});
}
hh: '%d 小時',
d: '1 天',
dd: '%d 天',
M: '1 個月',
MM: '%d 個月',
y: '1 年',
yy: '%d 年'
},
week: {
// GB/T 7408-1994, equivalent to ISO 8601:1988
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
})
} else {
moment.updateLocale('en', {
ordinal: function (number, period) {
var b = number % 10
var output = (~~(number % 100 / 10) === 1) ? 'th'
: (b === 1) ? 'st'
: (b === 2) ? 'nd'
: (b === 3) ? 'rd' : 'th'
return number + output
}
})
}
export const doesCrossDay = (moment1, moment2) => {
return moment1.format('YYYY-MM-DD') !== moment2.format('YYYY-MM-DD')
}
export const isValid = (updateAt, period) => {
export const set = (appLocale, navigatorLocale) => {
/**
* Note: moment.localeData will try to be smart and find the locale given the string. It can be
* 'fr', or 'fr-FR' and it will automatically handle that.
* If it can't find any match it will return the default format (American English).
*/
const navigatorLocaleData = moment.localeData(navigatorLocale);
const appLocaleData = moment.localeData(appLocale);
// Remove old configuration first, if any.
moment.updateLocale(CUSTOM_LOCALE, null);
/**
* By default we use the same date-time locale as you have selected in the app in order
* to get the correct translations for days, months, year, etc. However, we override
* the longDateFormat to get 12 or 24 hour time or the correct date format depending
* on what you have selected in your browser.
*/
moment.updateLocale(CUSTOM_LOCALE, {
// eslint-disable-next-line no-underscore-dangle
...appLocaleData._config,
// eslint-disable-next-line no-underscore-dangle
longDateFormat: navigatorLocaleData._config.longDateFormat
});
moment.locale(CUSTOM_LOCALE);
};
private initMomentLocale(lng: string) {
// Init the locale for the moment object (for date manipulations)
moment.locale(lng);
// 24h format
moment.updateLocale(lng, {
longDateFormat : i18n.t("longDateFormat", { returnObjects: true }),
});
}
}
import { CalendarIcon, Wrapper } from './datepicker.styles'
import { mobileMediaQuery } from '../../utils'
export interface DateRange {
startDate: Moment | null,
endDate: Moment | null,
}
export interface DatepickerProps {
onDateRangeChanged: (range: DateRange) => void,
startDate: Moment | null,
endDate: Moment | null,
id: string,
}
moment.updateLocale('en', { weekdaysMin: 'U_M_T_W_R_F_S'.split('_') })
export const Datepicker = ({ onDateRangeChanged, startDate, endDate, id }: DatepickerProps) => {
const isMobile = useMediaQuery(`(${mobileMediaQuery})`)
const [focusedInput, setFocusedInput] = useState<'startDate'| 'endDate' | null>(null)
return (
}
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { remote } from 'electron';
import clazz from 'classname';
import moment from 'moment';
import classes from './style.css';
import helper from 'utils/helper';
moment.updateLocale('en', {
relativeTime: {
past: '%s',
m: '1 min',
mm: '%d mins',
h: 'an hour',
hh: '%d h',
s: 'now',
ss: '%d s',
},
});
@inject(stores => ({
chats: stores.chat.sessions,
chatTo: stores.chat.chatTo,
selected: stores.chat.user,
messages: stores.chat.messages,
import moment from "moment"
moment.updateLocale("en", {
relativeTime: {
future: "in %s",
past: "%s ago",
s: "%ds",
m: "%dm",
mm: "%dm",
h: "%dh",
hh: "%dh",
d: "%dd",
dd: "%dd",
M: "%dM",
MM: "%dM",
y: "%dY",
yy: "%dY",
},
})
const moment = require('moment')
const {TimeoutError} = require('beaker-error-constants')
moment.updateLocale('en', {
relativeTime: {s: 'seconds'}
})
exports.niceDate = function (ts, opts) {
const endOfToday = moment().endOf('day')
if (typeof ts === 'number' || ts instanceof Date) { ts = moment(ts) }
if (ts.isSame(endOfToday, 'day')) {
if (opts && opts.noTime) { return 'today' }
return ts.fromNow()
} else if (ts.isSame(endOfToday.subtract(1, 'day'), 'day')) { return 'yesterday' } else if (ts.isSame(endOfToday, 'month')) { return ts.fromNow() }
return ts.format('ll')
}
exports.downloadTimestamp = function (ts) {
if (typeof ts === 'string') {
ts = moment(Number(ts))
constructor(props) {
super(props);
moment.updateLocale('en', {
relativeTime : {
future: "in%s",
past: "%s",
s : '1s',
ss : '%ds',
m: "1m",
mm: "%dm",
h: "1h",
hh: "%dh",
d: "1d",
dd: "%dd",
M: "1mth",
MM: "%dmth",
y: "1y",
yy: "%dy"
}
import React from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import backendServices from '../../../platform/user/profile/constants/backendServices';
import { removeSavedForm } from '../../../platform/user/profile/actions';
import UserDataSection from './UserDataSection';
import AuthApplicationSection from '../components/AuthApplicationSection';
import FormList from '../components/FormList';
import RequiredLoginView from '../../../platform/user/authorization/components/RequiredLoginView';
import DowntimeNotification, { externalServices } from '../../../platform/monitoring/DowntimeNotification';
moment.updateLocale('en', {
meridiem: (hour) => {
if (hour < 12) {
return 'a.m.';
}
return 'p.m.';
},
monthsShort: [
'Jan.',
'Feb.',
'Mar.',
'Apr.',
'May',
'June',
'July',
'Aug.',
'Sept.',