Last active
September 15, 2021 07:53
-
-
Save giuseppe998e/a3fdec46b1736c0a6602fbdbed84f71e to your computer and use it in GitHub Desktop.
Academic Year generator in JS (Start from October)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const academicYear = (firstMonth = 8) => { | |
| const date = new Date(), | |
| year = date.getFullYear(), | |
| start = date.getMonth() > firstMonth | |
| return `${year - !start}/${year + start}` | |
| } | |
| /* const academicYear=(firstMonth=8)=>{const d=new Date(),y=d.getFullYear(),s=d.getMonth()>firstMonth;return `${y-!s}/${y+s}`} */ | |
| console.log(`Academic Year: ${academicYear()}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment