Closed soichih closed 5 years ago
I could not find a better solution than :
// main.js
import VueTimeago from "vue-timeago";
import toNow from 'date-fns/distance_in_words_to_now'
Vue.use(VueTimeago, {
name: "Timeago",
converter: (date, locale, converterOptions) => {
const { includeSeconds, addSuffix = true } = converterOptions
return toNow(date, {
locale,
includeSeconds,
addSuffix
}).replace("less than a minute ago", "just now") // here
}
});
If anyone has better 🙏
You can manipulate it like what @jwheatp did here, or if you believe just now
is a better default, you can contribute to date-fns.
In the previous version, I was seeing "just now" if the date is less than 60 seconds old. On the latest version, it is now showing "less than a minute ago". I prefer "just now" as it was shorter and it fits the table I am using to display the date.
Is there a way to show "just now" (maybe by setting some custom option with date-fns)?