Skip to content

Commit ae50b1d

Browse files
committed
4031: Adds FY at a glance component and getFY util
1 parent c3b2e30 commit ae50b1d

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react'
2+
import { makeStyles } from '@material-ui/core/styles'
3+
import Typography from '@material-ui/core/Typography'
4+
import { getFiscalYear } from '../../utils/nrrdUtils'
5+
6+
const useStyles = makeStyles({
7+
h2: {
8+
marginTop: '0.5rem',
9+
marginBottom: '1rem',
10+
textAlign: 'center'
11+
},
12+
})
13+
14+
export default function FYAtAGlance() {
15+
const classes = useStyles()
16+
17+
return (
18+
<>
19+
<Typography variant="h2" className={classes.h2}>
20+
FY { getFiscalYear() } at a glance
21+
</Typography>
22+
</>
23+
)
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default from './FyAtAGlance'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function getFiscalYear() {
2+
const now = new Date();
3+
const year = now.getFullYear();
4+
const month = now.getMonth(); // 0 = Jan, 9 = Oct
5+
6+
return (month >= 9) ? year + 1 : year;
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as getFiscalYear } from './GetFiscalYear'

src/pages/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import { Tabtastic, TabtasticTab } from '../components/layouts/Tabtastic'
105105
</Tabtastic>
106106
</Grid>
107107
<Grid item xs={12} lg={4}>
108+
<FYAtAGlance />
108109
<Box bgcolor="primary.main" mb={2} pt={0.5} pb={2} pl={3} pr={3} borderRadius={10}>
109110
<MonthlyFactSheet />
110111
</Box>

0 commit comments

Comments
 (0)