feat: traversal of dates in Seek component

This commit is contained in:
Kyle Gill
2019-03-28 15:36:51 -06:00
parent b2ad7d544d
commit 7839ef9a52
9 changed files with 115 additions and 36 deletions

View File

@@ -1,5 +1,28 @@
import React from "react";
import React, { Component } from "react";
import { addDays, subDays, format, isToday } from "date-fns";
const Month = () => <div>Month</div>;
import Seek from "../../Seek";
class Month extends Component {
render() {
const {
match: {
params: { year, month }
}
} = this.props;
const currentDay = new Date(year, month - 1);
console.log(currentDay);
return (
<div>
<Seek
title={format(currentDay, "YYYY MMM")}
prev={format(subDays(currentDay, 1), "/YYYY/MM")}
next={"asdf"}
disableNext={isToday(new Date())}
/>
</div>
);
}
}
export default Month;