Skip to content

Instantly share code, notes, and snippets.

@giuseppe998e
Last active September 15, 2021 07:53
Show Gist options
  • Select an option

  • Save giuseppe998e/a3fdec46b1736c0a6602fbdbed84f71e to your computer and use it in GitHub Desktop.

Select an option

Save giuseppe998e/a3fdec46b1736c0a6602fbdbed84f71e to your computer and use it in GitHub Desktop.
Academic Year generator in JS (Start from October)
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