See documentation and demo at vue-datetime-js
npm install vue-datetime-js --save
webpack.config.js:
/**
* configuration for moment to ignore loading locales
*/
module.exports.plugins = [
//...
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
//...
]
main.js
//...
import VueDatetimeJs from 'vue-datetime-js';
Vue.component('date-picker', VueDatetimeJs);
//...
Or in component
<template>
<div>
<date-picker v-model="date"></date-picker>
</div>
</template>
<script>
import VueDatetimeJs from 'vue-datetime-js'
export default {
data(){
return {
date: ''
}
},
components: {
datePicker: VueDatetimeJs
}
}
</script>
main.js
import VueDatetimeJs from 'vue-datetime-js';
Vue.use(VuePersianDatetimePicker, {
name: 'custom-date-picker',
props: {
inputFormat: 'YYYY-MM-DD HH:mm',
format: 'jYYYY-jMM-jDD HH:mm',
editable: false,
inputClass: 'form-control my-custom-class-name',
placeholder: 'Please select a date',
altFormat: 'YYYY-MM-DD HH:mm',
color: '#00acc1',
autoSubmit: false,
//...
//... And whatever you want to set as default
//...
}
});
Then use in component
<custom-date-picker v-model="date"></custom-date-picker>
- Vuejs - The Progressive JavaScript Framework.
- Moment.js - Parse, validate, manipulate, and display dates and times in JavaScript.
- moment-jalaali - A Jalaali (Jalali, Persian, Khorshidi, Shamsi) calendar system plugin for moment.js.
- moment-hijri - A Hijri calendar (Based on Umm al-Qura calculations) plugin for moment.js.
- vue-persian-datetime-picker - A vue plugin to select jalali date and time.
This project is licensed under the MIT License
- Fix build and ReadMe
- Fix sample page vue
- Add calendar (gregory, jalali, hijri)
- Remove localeLange
- Add Hijri calendar
- Fix (Hijri ('ar-sa') - Jalalli ('fa') - Gregory ('en'))
- Some Test
- Add localeLange Prop
- Some Test
- Fix Readme file
- Fork from vue-persian-datetime-picker