Added proxy methods for date-fns
This commit is contained in:
parent
8c8095bda7
commit
024abebf2a
@ -1,8 +1,16 @@
|
|||||||
import EventGrouping from "./EventGrouping";
|
import EventGrouping from "./EventGrouping";
|
||||||
import { Event, Groups } from "../types";
|
import { Event, Groups } from "../types";
|
||||||
import { add, differenceInCalendarDays } from "date-fns";
|
import {
|
||||||
|
add,
|
||||||
|
differenceInCalendarDays,
|
||||||
|
isToday as dateFnsIsToday,
|
||||||
|
} from "date-fns";
|
||||||
|
|
||||||
export default class DayGrouping extends EventGrouping {
|
export default class DayGrouping extends EventGrouping {
|
||||||
|
static isToday(date: Date): boolean {
|
||||||
|
return dateFnsIsToday(date);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(sortedEvents: Event[]) {
|
constructor(sortedEvents: Event[]) {
|
||||||
super(sortedEvents);
|
super(sortedEvents);
|
||||||
this.groups = this.group();
|
this.groups = this.group();
|
||||||
|
|||||||
@ -1,8 +1,16 @@
|
|||||||
import EventGrouping from "./EventGrouping";
|
import EventGrouping from "./EventGrouping";
|
||||||
import { Event, Groups } from "../types";
|
import { Event, Groups } from "../types";
|
||||||
import { add, differenceInCalendarMonths } from "date-fns";
|
import {
|
||||||
|
add,
|
||||||
|
differenceInCalendarMonths,
|
||||||
|
isThisMonth as dateFnsIsThisMonth,
|
||||||
|
} from "date-fns";
|
||||||
|
|
||||||
export default class MonthGrouping extends EventGrouping {
|
export default class MonthGrouping extends EventGrouping {
|
||||||
|
static isThisMonth(date: Date): boolean {
|
||||||
|
return dateFnsIsThisMonth(date);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(sortedEvents: Event[]) {
|
constructor(sortedEvents: Event[]) {
|
||||||
super(sortedEvents);
|
super(sortedEvents);
|
||||||
this.groups = this.group();
|
this.groups = this.group();
|
||||||
|
|||||||
@ -1,8 +1,21 @@
|
|||||||
import EventGrouping from "./EventGrouping";
|
import EventGrouping from "./EventGrouping";
|
||||||
import { Event, Groups } from "../types";
|
import { Event, Groups } from "../types";
|
||||||
import { add, differenceInCalendarWeeks } from "date-fns";
|
import {
|
||||||
|
add,
|
||||||
|
differenceInCalendarWeeks,
|
||||||
|
getWeek as dateFnsGetWeek,
|
||||||
|
isThisWeek as dateFnsIsThisWeek,
|
||||||
|
} from "date-fns";
|
||||||
|
|
||||||
export default class WeekGrouping extends EventGrouping {
|
export default class WeekGrouping extends EventGrouping {
|
||||||
|
static isThisWeek(date: Date): boolean {
|
||||||
|
return dateFnsIsThisWeek(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getWeek(date: Date): number {
|
||||||
|
return dateFnsGetWeek(date);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(sortedEvents: Event[]) {
|
constructor(sortedEvents: Event[]) {
|
||||||
super(sortedEvents);
|
super(sortedEvents);
|
||||||
this.groups = this.group();
|
this.groups = this.group();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user