Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dayjs class undefined at runtime #2820

Open
ray-overjet opened this issue Jan 29, 2025 · 0 comments
Open

Dayjs class undefined at runtime #2820

ray-overjet opened this issue Jan 29, 2025 · 0 comments

Comments

@ray-overjet
Copy link

ray-overjet commented Jan 29, 2025

Describe the bug
Importing the Dayjs class results in undefined at runtime. Command clicking into the Dayjs symbol brings me to the correct definition in index.d.ts as expected. This happens when using require and ESM.

import dayjs from "dayjs";
// OR
const dayjs = require("dayjs");

console.log("dayjs.Dayjs:", dayjs.DayJs);
console.log("dayjs:", dayjs);

Output:

dayjs.Dayjs: undefined

dayjs: [Function: O] {
  extend: [Function (anonymous)],
  locale: [Function: t],
  isDayjs: [Function: S],
  unix: [Function (anonymous)],
  en: {
    name: 'en',
    weekdays: [
      'Sunday',
      'Monday',
      'Tuesday',
      'Wednesday',
      'Thursday',
      'Friday',
      'Saturday'
    ],
    months: [
      'January',   'February',
      'March',     'April',
      'May',       'June',
      'July',      'August',
      'September', 'October',
      'November',  'December'
    ],
    ordinal: [Function: ordinal]
  },
  Ls: {
    en: {
      name: 'en',
      weekdays: [Array],
      months: [Array],
      ordinal: [Function: ordinal]
    }
  },
  p: {}
}

Command clicking Dayjs in vscode brings us to the correct index.d.ts definition:

Image

Expected behavior
The Dayjs class should

Information

  • Day.js Version 1.11.13
  • OS: macOS
  • Browser: Node.js v22
  • Time zone: GMT-07:00 DST (Pacific Daylight Time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant