本文整理汇总了TypeScript中moment.weekdays函数的典型用法代码示例。如果您正苦于以下问题:TypeScript weekdays函数的具体用法?TypeScript weekdays怎么用?TypeScript weekdays使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了weekdays函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: moment
.config(($mdDateLocaleProvider: angular.material.IDateLocaleProvider) => {
$mdDateLocaleProvider.parseDate = (dateString: string) => {
console.log(dateString);
let m = moment(dateString, 'DD.MM.YYYY', true);
return m.isValid() ? m.utc().toDate() : new Date(NaN);
};
$mdDateLocaleProvider.formatDate = (date: Date) => {
if (date === undefined || date === null)
return null;
return moment(date).format('DD.MM.YYYY');
};
$mdDateLocaleProvider.months = moment.months();
$mdDateLocaleProvider.shortMonths = moment.monthsShort();
$mdDateLocaleProvider.days = moment.weekdays();
$mdDateLocaleProvider.shortDays = moment.weekdaysShort();
$mdDateLocaleProvider.firstDayOfWeek = 1;
})
开发者ID:pharmscription,项目名称:com.pharmscription.Frontend,代码行数:17,代码来源:app.ts
示例2:
const getWeekDays = () => moment.weekdays().map((day: string, i: number) => localeDate.clone().startOf('week').add(i, 'day').format('dd'));
开发者ID:Bhaskar0812,项目名称:angular-moment-picker,代码行数:1,代码来源:locale.ts
示例3: Promise
return new Promise(resolve => {
let date = moment(cordysDate, 'YYYY/MM/DDTHH:mm:ss.SSS');
if (cordysDate.indexOf('T') < 0) {
date = moment(cordysDate, 'YYYY/MM/DD HH:mm:ss');
}
// clone date and set 12:00 am
let dateWithoutTime = moment(date).startOf('day');
// today 12:00 am
let nowWithoutTime = moment().startOf('day');
// after today 12:00 am
if (nowWithoutTime.isSame(dateWithoutTime)) {
if (hideTime) {
this.translate.get('app.date.today').subscribe(message => {
resolve(message);
});
} else {
resolve(date.fromNow());
}
}
// after yesterday 12:00 am
// 昨日 12:00 / 昨天 12:00 / Yesterday 12:00
if (moment(nowWithoutTime).subtract(1, 'days').isSame(dateWithoutTime)) {
this.translate.get('app.date.yesterday').subscribe(message => {
if (hideTime) {
resolve(message);
} else {
resolve(message + date.format('H:mm'));
}
});
}
// yesterday 12:00am ~ last week 12:00 am
// X曜日 / 星期X / Mon.
if (moment(nowWithoutTime).subtract(1, 'days').isAfter(dateWithoutTime) &&
(moment(nowWithoutTime).subtract(7, 'days').isSame(dateWithoutTime) ||
moment(nowWithoutTime).subtract(7, 'days').isBefore(dateWithoutTime))) {
resolve(moment.weekdays(date.day()));
}
// 182days(half of a year) before 12:00am ~ last week 12:00 am
// M月d日 / M月d日 / Mnd/d
if (moment(nowWithoutTime).subtract(7, 'days').isAfter(dateWithoutTime) &&
(moment(nowWithoutTime).subtract(182, 'days').isSame(dateWithoutTime) ||
moment(nowWithoutTime).subtract(182, 'days').isBefore(dateWithoutTime))) {
let parameter = {
'MM': (date.month() + 1),
'DD': date.date()
};
this.translate.get('app.date.MMDD', parameter).subscribe(message => {
resolve(message);
});
}
// 183days before 12:00am
if (moment(nowWithoutTime).subtract(182, 'days').isAfter(dateWithoutTime)) {
let parameter = {
'YYYY': date.year(),
'MM': (date.month() + 1)
};
this.translate.get('app.date.YYYYMM', parameter).subscribe(message => {
resolve(message);
});
}
});
开发者ID:intasect,项目名称:intalinx-mobile,代码行数:67,代码来源:dateutil.ts
示例4: weekdays
public weekdays(number): string {
return moment.weekdays(number);
}
开发者ID:rlasjunies,项目名称:kct,代码行数:3,代码来源:days-encoding.ts
示例5: getWeekday
getWeekday(dateString: string) {
return moment.weekdays(moment(dateString).day());
}
开发者ID:Meistercoach83,项目名称:sfw,代码行数:3,代码来源:calendar.service.ts
注:本文中的moment.weekdays函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论