<template>
    <input type="text" class="form-control" :value="value">
</template>

<script>
    export default {
        mounted: function() {
            let vm = this;
            $(this.$el).datepicker({
                autoclose: true,
                format: 'dd-mm-yyyy',
                todayBtn: true,
                todayHighlight: true
            }).on('changeDate',function(event){
                if(event.target.value !== ''){
                    vm.$emit('updateDate', event.target.value)
                }

            })
        },
        props: ['value']
    }
</script>
