hugoWebsite/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
Jeremy Nusser 0ab675d92b Initial commit... 🎉🎉🎉
2022-10-28 17:20:35 -05:00

13 lines
No EOL
498 B
JavaScript

import toDate from "../../toDate/index.js";
import requiredArgs from "../requiredArgs/index.js";
var MILLISECONDS_IN_DAY = 86400000;
export default function getUTCDayOfYear(dirtyDate) {
requiredArgs(1, arguments);
var date = toDate(dirtyDate);
var timestamp = date.getTime();
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
var startOfYearTimestamp = date.getTime();
var difference = timestamp - startOfYearTimestamp;
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
}