Question: I'am vuejs-datepicker . I'm trying to print the selected date which is stored in a variable in data. Initially the value of the variable is empty. vuejs-datepicker supports the selected event. so when the event is triggering, I mean if date is selected the selected event get triggered. but does not print ta current selected date rather it print empty string. if I again select another date the it prints the previous date. It is printing the the previous stored date. code is given below

**Uses**

```
 <date-picker :bootstrap-styling="true" class="datepicker form-control" 
 placeholder="Select Date" v-model="appointment.appointmet_date" 
 @selected="dateSelected()"></date-picker>

```

**dateSelected method**

```
dateSelected () {
   console.log(this.appointment.appointmet_date)         
},

```

**data property**

```
data () {
    return {
        appointment: {
            appointmet_date: '',
        }
    }
}

```

![enter image description here](https://i.stack.imgur.com/AXnvK.jpg)

When I entered first date it printed `null`. when I entered date second time it printed the time entered first time

**upadate**

```
  dateSelected () {
      // console.log(this.appointment.appointmet_date)
      var self = this
      this.$nextTick(() => console.log(self.appointment.appointmet_date))
      this.$http.post(apiDomain + 'api/getAvailableDate', {avlDate: self.appointment.appointmet_date})
            .then(response => {
                console.log(response)
            })

    }

```

Answer: 
> 
> when i entered first date it printed null. when i entered date second time it printed the time entered first time
> 
> 
> 

Yes because the selected event is fired before the Vue [`nextTick`](https://v2.vuejs.org/v2/api/#Vue-nextTick) function which updates the `v-model`.

Please below code and working [codesandbox](https://codesandbox.io/s/vuejs-datepicker-selected-event-v9ikz) demo.

```
dateSelected (e) {
  console.log(this.appointment.appointmet_date);
  this.$nextTick(() => console.log(this.appointment.appointmet_date))
},

```
For future visitors - simply make the post request within the Vue nextTick() like so:

```
dateSelected () {
  ...
  this.$nextTick(() => {/* post call here */})
}

```