Last active
August 27, 2018 04:33
-
-
Save M0nica/b4317ee1903a66a37d3737d6045932e1 to your computer and use it in GitHub Desktop.
This file contains 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
import { LocalDate, ChronoUnit } from "js-joda"; | |
export function getToday() { | |
return LocalDate.now(); | |
} | |
export function getNextYear(date) { | |
return date.year() + 1; | |
} | |
export function getFirstDayNextYear(nextYear) { | |
return LocalDate.of(nextYear, 1, 1); | |
} | |
export function getDaysUntilNextYear(today, firstDayNextYear) { | |
return today.until(firstDayNextYear, ChronoUnit.DAYS); | |
} | |
export function checkNYE(getDaysUntilNextYear) { | |
return Boolean(getDaysUntilNextYear == 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment