📅  最后修改于: 2022-03-11 15:03:42.127000             🧑  作者: Mango
// first install moment.js: npm i moment
import moment from 'moment'
let date = moment("2019-01-01", "YYYY-MM-DD");
console.log(date.fromNow()); // 3 years ago