I am using a datepicker to set a moment.js
date which is being set in my Vuex store:
Store state:
const state = {
arrival: '',
departure: ''
}
Getters:
const getters = {
arrival: state => state.arrival,
departure: state => state.departure,
prettyArrival: (state) => {
if (state.arrival instanceof moment) {
return state.arrival.format(state.prettyFormat);
}
return '';
}
}
My vuex store is properly updating the arrival state(which is a moment.js
object) because I can clearly see the devtools showing the updates and the original state changing.
The prettyArrival is not updating properly though. It is only being set once when the arrival changes from an empty string to a moment.js
object.
My arrival getter shows in the devtools like this:
arrival:"2017-07-21T09:15:53.770Z"
When I log it I get the moment.js
object though with seems to contain reactiveGetters
and reactiveSetters
so the reactivity seems in place.
Is there something wrong with how I set up my getter or is something else wrong here?
Any tips are welcome, if you need more info let me know.