Skip to content

Instantly share code, notes, and snippets.

@M0nica
Last active August 27, 2018 04:33
Show Gist options
  • Save M0nica/b4317ee1903a66a37d3737d6045932e1 to your computer and use it in GitHub Desktop.
Save M0nica/b4317ee1903a66a37d3737d6045932e1 to your computer and use it in GitHub Desktop.
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