Skip to content

Passing Day.js instance to Moment returns current date instead of original value #3025

@SinghChinmay

Description

@SinghChinmay

Describe the bug
When a Day.js instance is passed directly to Moment (moment(dayjsValue)), the resulting Moment date becomes the current date instead of the Day.js date for some inputs.

In my case, this caused a CSV export range bug: selecting 2026-03-01 to 2026-03-19 ended up sending from as 2026-03-19 (today), so only today's records were exported.

Expected behavior
moment(dayjs('2026-03-01')) should represent 2026-03-01, not the current date.

Actual behavior
moment(dayjs('2026-03-01')).format() returns 2026-03-19... (current day in my environment).

Minimal reproduction

const moment = require('moment')
const dayjs = require('dayjs')

const d = dayjs('2026-03-01')

console.log('dayjs:', d.format()) // 2026-03-01T00:00:00+09:00
console.log('moment(dayjs):', moment(d).format()) // 2026-03-19T00:00:00+09:00 (unexpected)
console.log('moment(dayjs.toDate()):', moment(d.toDate()).format()) // 2026-03-01T00:00:00+09:00 (expected)

Day.js Version: 1.11.19
OS: Linux
Browser: N/A (Node.js reproduction)
Node.js: v24.0.0
Moment Version: 2.30.1
Time zone: Asia/Tokyo (GMT+09:00)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions