chore: constants file, styling, and seek component

This commit is contained in:
Kyle Gill
2019-03-27 16:55:23 -06:00
parent f71fb0bb52
commit 043acd30cf
10 changed files with 103 additions and 9 deletions

14
src/utils/date.js Normal file
View File

@@ -0,0 +1,14 @@
import format from "date-fns/format";
export const pad = n => (n < 10 ? "0" : "") + n;
export const todayUrl = (date = new Date()) =>
`/${date.getFullYear()}/${pad(date.getMonth() + 1)}/${pad(date.getDate())}/`;
export const yearUrl = (date = new Date()) => `/${date.getFullYear()}/`;
export const months = {
short: Array.from({ length: 12 }, (x, index) =>
new Date(0, index).toLocaleDateString("en-US", { month: "short" })
)
};