Skip to main content
variable dayOfYear
import { dayOfYear } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

dayOfYear: Gets the day of the year from a Date object.

Use new Date() and Date.prototype.getFullYear() to get the first day of the year as a Date object, subtract it from the provided date and divide with the milliseconds in each day to get the result. Use Math.floor() to appropriately round the resulting day count to an integer.

type

(date: Date | string) => number