本文整理匯總了TypeScript中@angular/common.formatDate函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript formatDate函數的具體用法?TypeScript formatDate怎麽用?TypeScript formatDate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了formatDate函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: updateData
updateData() {
const time: Date = new Date(),
formattedTime = formatDate(time, 'HH:mm:ss', 'en'),
random = getRandomInt(1, 40),
data = this.data.series[0],
labels = this.data.labels;
labels.push(formattedTime);
data.push(random);
// We only want to display 10 data points at a time
this.data.labels = labels.slice(-9);
this.data.series[0] = data.slice(-9);
this.data = { ...this.data };
}
示例2: dayViewHour
/**
* The time formatting down the left hand side of the day view
*/
public dayViewHour({ date, locale }: DateFormatterParams): string {
return formatDate(date, 'h a', locale);
}
示例3: dayViewTitle
/**
* The day view title
*/
public dayViewTitle({ date, locale }: DateFormatterParams): string {
return formatDate(date, 'EEEE, MMMM d, y', locale);
}
示例4: formatDate
const format = (dateToFormat: Date, showYear: boolean) =>
formatDate(dateToFormat, 'MMM d' + (showYear ? ', yyyy' : ''), locale);
示例5: weekViewColumnSubHeader
/**
* The week view sub header day and month labels
*/
public weekViewColumnSubHeader({
date,
locale
}: DateFormatterParams): string {
return formatDate(date, 'MMM d', locale);
}
示例6: monthViewTitle
/**
* The month view title
*/
public monthViewTitle({ date, locale }: DateFormatterParams): string {
return formatDate(date, 'LLLL y', locale);
}
示例7: monthViewDayNumber
/**
* The month view cell day number
*/
public monthViewDayNumber({ date, locale }: DateFormatterParams): string {
return formatDate(date, 'd', locale);
}
示例8: monthViewColumnHeader
/**
* The month view header week day labels
*/
public monthViewColumnHeader({ date, locale }: DateFormatterParams): string {
return formatDate(date, 'EEEE', locale);
}