date-fns/date-fns.org

The documentation on date-fns main page are incorrect

warifmust opened this issue · 1 comments

I am new to date-fns. I used to be using of moment js. However, I was trying date-fns because a lot of articles said that it is better, faster, etc. Hence, I start to play around with date-fns and got really confused with the main page documentation.

import { format, formatDistance, formatRelative, subDays } from 'date-fns'

format(new Date(), '[Today is a] dddd')
//=> "Today is a Sunday"

etc etc

I tried this on my project a lot of times and instead of returning Sunday, it returns 0007. While doing some more research and reading the documentations inside, I found that the correct one should be format(new Date(), '[Today is a] EEEE') to be able to return the name of the day. There is no pattern at all for dddd.

Hence, I think the main page should probably be updated. Thank you.

tan75 commented

@Edenghajakk
thank you for reporting this - we will fix it shortly.