chore: constants file, styling, and seek component
This commit is contained in:
14
src/utils/date.js
Normal file
14
src/utils/date.js
Normal 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" })
|
||||
)
|
||||
};
|
||||
Reference in New Issue
Block a user