Adds upcoming public holidays widget

This commit is contained in:
Alicia Sykes
2021-12-17 16:52:12 +00:00
parent b7cd2d4c06
commit be5188ef7d
5 changed files with 184 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable arrow-body-style */
import { hideFurnitureOn } from '@/utils/defaults';
/* Returns false if page furniture should be hidden on said route */
@@ -50,7 +51,7 @@ export const applyItemId = (inputSections) => {
export const convertTimestampToDate = (timestamp) => {
const localFormat = navigator.language;
const dateFormat = {
weekday: 'short', day: 'numeric', month: 'short', year: 'numeric',
weekday: 'short', day: 'numeric', month: 'short', year: '2-digit',
};
const date = new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
return `${date}`;
@@ -91,3 +92,7 @@ export const showNumAsThousand = (bigNum) => {
if (bigNum < 1000) return bigNum;
return `${Math.round(bigNum / 1000)}k`;
};
export const capitalize = (str) => {
return str.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
};