Commit 24fca134 authored by Inès Yeterian's avatar Inès Yeterian
Browse files

Change year change date

parent 63e88e36
......@@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
package-lock.json
\ No newline at end of file
......@@ -5,12 +5,12 @@ import FormToucan from '../../utils//FormToucan.js'
import ToucanCard from './ToucanCard'
const date = new Date()
const beginYear = 1900 + (date.getMonth() < 8 ? date.getYear()-1 : date.getYear());
const beginYear = 1900 + (date.getMonth() < 7 ? date.getYear()-1 : date.getYear());
function AllToucan(props){
const [toucans,setToucans] = useState([]);
const [before,setBefore] = useState((new Date(beginYear+1,7,31)).getTime());
const [after, setAfter] = useState((new Date(beginYear,8,1)).getTime());
const [before,setBefore] = useState((new Date(beginYear+1,6,31)).getTime());
const [after, setAfter] = useState((new Date(beginYear,7,1)).getTime());
useEffect(()=>{
fetch(`${props.backURL}/toucan/toucans?before=${before}&after=${after}`)
......@@ -25,8 +25,8 @@ function AllToucan(props){
)
function updateFrame(value){
var before = (new Date(value+1,7,31)).getTime()
var after = (new Date(value,8,1)).getTime()
var before = (new Date(value+1,6,31)).getTime()
var after = (new Date(value,7,1)).getTime()
setBefore(before)
setAfter(after)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment