Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

constructNow

import { constructNow } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
import { constructNow, isSameDay } from 'date-fns'

function isToday<DateType extends Date>(
  date: DateType | number | string,
): boolean {
  // If we were to use `new Date()` directly, the function would  behave
  // differently in different timezones and return false for the same date.
  return isSameDay(date, constructNow(date));
}
function constructNow<DateType extends Date>(date: DateType | number | string): DateType;
§
constructNow<DateType extends Date>(date: DateType | number | string): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The reference date to take constructor from

§Return Type

§
DateType
[src]

Current date initialized using the given date constructor