angular-calendar
Version:
A calendar component that can display events on a month, week or day view
88 lines • 3.08 kB
JavaScript
import { OpaqueToken, Inject } from '@angular/core';
export var MOMENT = new OpaqueToken('Moment');
/**
* This will use <a href="http://momentjs.com/" target="_blank">moment</a> to do all date formatting. To use this class:
*
* ```
* import { CalendarDateFormatter, CalendarMomentDateFormatter, MOMENT } from 'angular-calendar';
* import * as moment from 'moment';
*
* // in your component
* provide: [{
* provide: MOMENT, useValue: moment
* }, {
* provide: CalendarDateFormatter, useClass: CalendarMomentDateFormatter
* }]
*
* ```
*/
export var CalendarMomentDateFormatter = (function () {
/**
* @hidden
*/
function CalendarMomentDateFormatter(moment) {
this.moment = moment;
}
/**
* The month view header week day labels
*/
CalendarMomentDateFormatter.prototype.monthViewColumnHeader = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('dddd');
};
/**
* The month view cell day number
*/
CalendarMomentDateFormatter.prototype.monthViewDayNumber = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('D');
};
/**
* The month view title
*/
CalendarMomentDateFormatter.prototype.monthViewTitle = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('MMMM YYYY');
};
/**
* The week view header week day labels
*/
CalendarMomentDateFormatter.prototype.weekViewColumnHeader = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('dddd');
};
/**
* The week view sub header day and month labels
*/
CalendarMomentDateFormatter.prototype.weekViewColumnSubHeader = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('D MMM');
};
/**
* The week view title
*/
CalendarMomentDateFormatter.prototype.weekViewTitle = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('[Week] W [of] YYYY');
};
/**
* The time formatting down the left hand side of the day view
*/
CalendarMomentDateFormatter.prototype.dayViewHour = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('ha');
};
/**
* The day view title
*/
CalendarMomentDateFormatter.prototype.dayViewTitle = function (_a) {
var date = _a.date, locale = _a.locale;
return this.moment(date).locale(locale).format('dddd, D MMMM, YYYY');
};
/** @nocollapse */
CalendarMomentDateFormatter.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [MOMENT,] },] },
]; };
return CalendarMomentDateFormatter;
}());
//# sourceMappingURL=calendarMomentDateFormatter.provider.js.map