本文整理汇总了TypeScript中moment.updateLocale函数的典型用法代码示例。如果您正苦于以下问题:TypeScript updateLocale函数的具体用法?TypeScript updateLocale怎么用?TypeScript updateLocale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateLocale函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: initMomentLocale
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 }),
});
}
开发者ID:ScoutmanPt,项目名称:PnP,代码行数:10,代码来源:LocalizationModule.ts
示例2: loadLocale
export function loadLocale(locale: string) {
if (locale) {
let loc_mom = MOM_LOCALES[locale];
if (!loc_mom) {
return;
}
let keys = Object.keys(loc_mom);
let config = {};
keys.map(item => {
config[item.substring(1)] = loc_mom[item];
});
moment.updateLocale(locale, config);
}
}
开发者ID:gatsbimantico,项目名称:ontimize-web-ngx,代码行数:14,代码来源:locales.ts
示例3: moment
export const calculateFirstDateOfWeek: CalculateFirstDateOfWeekFn = (
currentDate, firstDayOfWeek, excludedDays = [],
) => {
const currentLocale = moment.locale();
moment.updateLocale('tmp-locale', {
week: { dow: firstDayOfWeek, doy: 1 }, // `doy` is required for TS using
});
const firstDateOfWeek = moment(currentDate as Date).startOf('week');
if (excludedDays.indexOf(firstDayOfWeek) !== -1) {
excludedDays.slice().sort().forEach((day) => {
if (day === firstDateOfWeek.day()) {
firstDateOfWeek.add(1, 'days');
}
});
}
moment.locale(currentLocale);
return firstDateOfWeek.toDate();
};
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:19,代码来源:utils.ts
示例4: moment
// Fri Feb 27 2015 11:00:00 GMT+0000
moment('2015-02-28T16:00:00Z').subtractWorkingTime(5, 'hours');
// Fri Feb 27 2015 12:00:00 GMT+0000
moment('2015-02-27T16:00:00Z').subtractWorkingTime(5, 'hours', 30, 'minutes');
// Fri Feb 27 2015 10:30:00 GMT+0000
moment('2015-02-27T16:30:00Z').workingDiff(moment('2015-02-26T12:00:00Z'), 'hours');
// 12
moment('2015-02-27T16:30:00Z').workingDiff(moment('2015-02-26T12:00:00Z'), 'hours', true);
// 12.5
// set opening time to 09:30 and close early on Wednesdays
moment.updateLocale('en', {
workinghours: {
0: null,
1: ['09:30:00', '17:00:00'],
2: ['09:30:00', '17:00:00'],
3: ['09:30:00', '13:00:00'],
4: ['09:30:00', '17:00:00'],
5: ['09:30:00', '17:00:00'],
6: null
}
});
moment('2015-02-25T15:00:00Z').isWorkingTime(); // false
moment('2015-02-23T09:00:00Z').isWorkingTime(); // false
moment.updateLocale('en', {
holidays: [
'2015-05-04'
]
});
moment('2015-05-04T09:30:00Z').isWorkingDay(); // false
moment.updateLocale('en', {
holidays: [
开发者ID:AdaskoTheBeAsT,项目名称:DefinitelyTyped,代码行数:31,代码来源:moment-business-time-tests.ts
注:本文中的moment.updateLocale函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论