@technobuddha/library
Version:
A large library of useful functions
8 lines (7 loc) • 344 B
JavaScript
import { ticksPerDay } from '../constants';
import floor from '../floor';
import getBeginningOfYear from '../getBeginningOfYear';
export function getDayOfYear(input, { UTC = false } = {}) {
return floor((input.getTime() - getBeginningOfYear(input, { UTC }).getTime()) / ticksPerDay, { tolerance: 0.05 }) + 1;
}
export default getDayOfYear;