UNPKG

angular-calendar

Version:

A calendar component that can display events on a month, week or day view

37 lines 1.67 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; import { CalendarNativeDateFormatter } from './calendarNativeDateFormatter.provider'; /** * This class is responsible for all formatting of dates. There are 2 implementations available, the `CalendarNativeDateFormatter` (default) which will use the <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Intl" target="_blank">Intl</a> API to format dates, or there is the `CalendarMomentDateFormatter` which uses <a href="http://momentjs.com/" target="_blank">moment</a>. * * If you wish, you may override any of the defaults via angulars DI. For example: * * ``` * import { CalendarDateFormatter, DateFormatterParams } from 'angular-calendar'; * * class CustomDateFormatter extends CalendarDateFormatter { * * public monthViewColumnHeader({date, locale}: DateFormatterParams): string { * return new Intl.DateTimeFormat(locale, {weekday: 'short'}).format(date); // use short week days * } * * } * * // in your component that uses the calendar * providers: [{ * provide: CalendarDateFormatter, * useClass: CustomDateFormatter * }] * ``` */ export var CalendarDateFormatter = (function (_super) { __extends(CalendarDateFormatter, _super); function CalendarDateFormatter() { _super.apply(this, arguments); } return CalendarDateFormatter; }(CalendarNativeDateFormatter)); //# sourceMappingURL=calendarDateFormatter.provider.js.map