Utility
Available utilities
How to use
import { useState } from 'react'
import {
GUI,
Utility
} from '@root'
/*
OR you can import from the modules import name
import { Utility } from 'Dashboard/modules'
*/
const {
DateFNS
} = Utility
const App = () => {
const [dateValue, setDateValue] = useState(new Date())
const handleNextDay = () => {
const updatedDate = DateFNS.addDays(dateValue, 1)
setDateValue(updatedDate)
}
const handlePreviousDay = () => {
const updatedDate = DateFNS.subDays(dateValue, 1)
setDateValue(updatedDate)
}
return (
<div>
<GUI.Button onClick={handleNextDay}>
{'Next day'}
</GUI.Button>
<p>{DateFNS.format(dateValue)}</p>
<GUI.Button onClick={handlePreviousDay}>
{'Previous day'}
</GUI.Button>
</div>
)
}
export default AppLast updated