Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initializeApp() {
moment.locale('zh-cn');
const enterHome = () => {
this.statusBar.styleDefault();
this.splashScreen.hide();
};
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
if (this.platform.is('android')) {
this.androidFullScreen.isImmersiveModeSupported()
.then(err => {
console.log(err);
return this.androidFullScreen.immersiveMode();
})
.then(enterHome)
async run ({ t, author, channel, language }, address) {
moment.locale(language)
channel.startTyping()
const city = await this.client.apis.gmaps.searchCity(address)
if (city) {
const [ lang ] = language.split('-')
const { lat, lng } = city.geometry.location
// TODO: configurable units
const { currently, daily: { data: daily }, timezone } = await this.client.apis.darksky.getForecast(lat, lng, { lang, units: 'ca' })
const now = daily.shift()
const weatherInfo = {
now: {
temperature: `${this.tempHumanize(currently.temperature, true)}`,
wind: `${this.tempHumanize(currently.windSpeed)} km/h`,
max: this.tempHumanize(now.temperatureHigh),
min: this.tempHumanize(now.temperatureLow),
icon: currently.icon
import moment from 'moment'
// 设置语言为中文
moment.locale('zh-cn')
/**
* @param {number} hours
*/
export function getDateAfterHours(hours) {
const now = new Date()
return new Date(now.setHours(now.getHours() + hours))
}
/**
* @param {number} days
*/
export function getDateAfterDays(days) {
const now = new Date()
return new Date(now.setHours(now.getHours() + days * 24))
}
var moment = require('moment'),
minimatch = require('minimatch');
var localeData = require('../locale/default');
moment.updateLocale(moment.locale(), localeData);
function getLocaleData(key) {
return moment.localeData()['_' + key];
}
function openingTimes(d) {
d = d.clone();
var hours = getLocaleData('workinghours');
if (!d.isWorkingDay()) {
return null;
}
return toWorkingTimeSegments(hours[d.day()].map(function (time) {
time = time.split(':');
var _d = d.clone();
_d.hours(time[0]);
_d.minutes(time[1] || 0);
async run(msg) {
const langSet = msg.client.provider.getGuild(msg.guild.id, 'language');
const lang = require(`../../languages/${langSet}.json`);
const { queue } = msg.client;
const { skipvote } = msg.client;
const input = msg.content.split(' ');
const searchString = input.slice(1).join(' ');
const url = input[1] ? input[1].replace(/<(.+)>/g, '$1') : '';
moment.locale(msg.client.provider.getGuild(msg.guild.id, 'momentLanguage'));
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel) return msg.channel.send(lang.play_notvoicechannel);
for (let i = 0; i < msg.client.provider.getGuild(msg.guild.id, 'musicchannelblacklist').length; i += 1) {
if (voiceChannel.id === msg.client.provider.getGuild(msg.guild.id, 'musicchannelblacklist')[i]) return msg.reply(lang.play_blacklistchannel);
}
async function play(guild, song) {
const serverQueue = await queue.get(guild.id);
if (!song) {
await serverQueue.voiceChannel.leave();
await queue.delete(guild.id);
return;
useEffect(() => {
i18next.changeLanguage(settings.language);
moment.locale(settings.language);
}, [settings]);
private buildDatePage(newLocale?) {
if (!this.current.isValid || !this.current.isValid()) return;
if (newLocale) moment.locale(newLocale);
if (this.datePage == 0) {
this.weekdays = moment.weekdaysMin();
this.title = moment(this.current.toISOString()).format('MMMM YYYY');
let start = moment(this.current).startOf('month');
let end = moment(this.current).endOf('month');
if (start.day() < 3) start.add(-7, 'day');
start.add(start.day() * -1, 'day');
end = end.add(6 - end.day(), 'day');
this.dates = [];
for (var w = 0; w < 6; w++) {
let wk = { wk: moment(start).add(w, 'week').week(), dt: [] }
for (var d = 0; d < 7; d++) {
const updateMomentLocale = (locale, firstDayOfWeek) => {
moment.locale(locale)
if (firstDayOfWeek) {
const firstDayNumber = Number.isInteger(firstDayOfWeek) && firstDayOfWeek === 0
? 7
: firstDayOfWeek || moment.localeData(locale).firstDayOfWeek()
moment.updateLocale(locale, {
week: {
dow: firstDayNumber
}
})
}
}
import { Utils } from '../../utils/utils.js';
import toaster from '../../components/toast';
import MainPanelTopbar from './main-panel-topbar';
import ModalPortal from '../../components/modal-portal';
import RoleEditor from '../../components/select-editor/role-editor';
import AddDepartDialog from '../../components/dialog/org-add-department-dialog';
import AddMemberDialog from '../../components/dialog/org-add-member-dialog';
import DeleteMemberDialog from '../../components/dialog/org-delete-member-dialog';
import AddRepoDialog from '../../components/dialog/org-add-repo-dialog';
import DeleteRepoDialog from '../../components/dialog/org-delete-repo-dialog';
import DeleteDepartDialog from '../../components/dialog/org-delete-department-dialog';
import SetGroupQuotaDialog from '../../components/dialog/org-set-group-quota-dialog';
import { serviceURL, siteRoot, gettext, orgID, lang } from '../../utils/constants';
import '../../css/org-department-item.css';
moment.locale(lang);
class OrgDepartmentItem extends React.Component {
constructor(props) {
super(props);
this.state = {
groupName: '',
isItemFreezed: false,
ancestorGroups: [],
members: [],
deletedMember: {},
isShowAddMemberDialog: false,
showDeleteMemberDialog: false,
repos: [],
deletedRepo: {},
isShowAddRepoDialog: false,
const momentLocaleMiddleware = store => next => action => {
if(action.type === INITIALIZE) {
moment.locale(action.payload.options.defaultLanguage);
}
if(action.type === SET_ACTIVE_LANGUAGE) {
moment.locale(action.payload.languageCode);
}
next(action);
};