0👍
I’ve not used moment.js
before but from your code, I figure this is how it’s used to format dates
const max = moment(data.map(obj => new Date(obj.mas_plan_end ?? '')).reduce((a, b) => b > a ? b : a)).format("YYYY-MM-DD");
const min = moment(data.map(obj => new Date(obj.mas_plan_start ?? '')).reduce((a, b) => b < a ? b : a)).format("YYYY-MM-DD");
The ??
operator I used is called the nullish coalescing operator
it returns the second value, if the first value is null or undefined. Nullish Coalescing MDN
- [Vuejs]-Cant get modal transition working on leave
- [Vuejs]-How do I get multiple actions and state with Vuex namespaced modules and the Vue Composition API?
Source:stackexchange.com