2018-03-17 18:26:18 +05:30
|
|
|
<script>
|
2021-03-08 18:12:59 +05:30
|
|
|
import { GlDatepicker } from '@gitlab/ui';
|
|
|
|
import { pikadayToString } from '~/lib/utils/datetime_utility';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
name: 'DatePicker',
|
2021-02-22 17:27:13 +05:30
|
|
|
components: {
|
2021-03-08 18:12:59 +05:30
|
|
|
GlDatepicker,
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
|
|
|
selectedDate: {
|
|
|
|
type: Date,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
minDate: {
|
|
|
|
type: Date,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
maxDate: {
|
|
|
|
type: Date,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2021-03-08 18:12:59 +05:30
|
|
|
selected(date) {
|
|
|
|
this.$emit('newDateSelected', pikadayToString(date));
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
toggled() {
|
|
|
|
this.$emit('hidePicker');
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2021-03-08 18:12:59 +05:30
|
|
|
<gl-datepicker
|
|
|
|
:value="selectedDate"
|
|
|
|
:min-date="minDate"
|
|
|
|
:max-date="maxDate"
|
|
|
|
start-opened
|
|
|
|
@close="toggled"
|
|
|
|
@click="toggled"
|
|
|
|
@input="selected"
|
|
|
|
/>
|
2018-03-17 18:26:18 +05:30
|
|
|
</template>
|