moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.05k stars 730 forks source link

Property 'now' does not exist on type 'typeof DateTime'. #1598

Open siberry opened 3 months ago

siberry commented 3 months ago

Describe the bug I am using Luxon DateTime with Typescript and am having no other type errors except for when using DateTime.now() I am getting the type error Property 'now' does not exist on type 'typeof DateTime'.

To Reproduce When using Typescript:

DateTime.now()

Actual vs Expected behavior DateTime.now would not throw a type error

Desktop (please complete the following information):

tzaitsev-rl commented 3 months ago

@siberry I saw this as well, do you happen to be using ES6 modules?

import DateTime from "luxon"; 
// or import * as DateTime from "luxon";
//requires you to write DateTime.Datetime.now()
import { DateTime } from "luxon";
//requires you to write DateTime.now()