📌  相关文章
📜  date-fns 天数差异 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:30.263000             🧑  作者: Mango

代码示例1
import { format, formatDistance, formatRelative, subDays } from 'date-fns'

format(new Date(), "'Today is a' eeee")
//=> "Today is a Wednesday"

formatDistance(subDays(new Date(), 3), new Date(), { addSuffix: true })
//=> "3 days ago"

formatRelative(subDays(new Date(), 3), new Date())
//=> "last Friday at 7:26 p.m."