date-io icon indicating copy to clipboard operation
date-io copied to clipboard

many .date methods return "any" type

Open moltar opened this issue 5 years ago • 1 comments

From your example:

import LuxonAdapter from '@date-io/luxon'
import DateFnsAdapter from '@date-io/date-fns'

const dateFns = new DateFnsAdapter()
const luxon = new LuxonAdapter({ locale: 'fr' }) // pass french locale

const initialLuxonDate = luxon.date('2018-10-28T11:44:00.000Z')
const initialDateFnsDate = dateFns.date('2018-10-28T11:44:00.000Z')

const updatedLuxonDate = luxon.addDays(initialLuxonDate, 2)
const updatedDateFnsDate = dateFns.addDays(initialDateFnsDate, 2)

luxon.format(updatedLuxonDate, 'fullDateTime24h') // "2018, octobre 30 11:44"
dateFns.format(updatedLuxonDate, 'fullDateTime24h') // "2018, October 30th 11:44"
  • luxon.date: returns any
  • dateFns.date: returns Date

I also checked moment and it also returns any.

moltar avatar Apr 08 '20 10:04 moltar

Hmm, yeah it looks like a problem. Would you like to investigate it and open an a PR?

dmtrKovalenko avatar Apr 08 '20 15:04 dmtrKovalenko