Date Picker
Date pickers let the user select a date.
Import
js
import { MpDatePicker } from '@mekari/pixel3'
Playground
API
MpDatePicker
Props
Events
Slots
Name | Type | Default |
---|---|---|
id | string | - |
model-value | Date | Date[] | string | string[] | number | number[] | - |
type | date | month | year | week | biweek | date |
value-type | date | string | timestamp | date |
format | string | - |
range-separator | string | - |
placeholder | string | - |
error-message | string | Format tanggal/waktu salah |
disabled-message | string | - |
lang | {} | - |
input-attr | {} | - |
content-attr | {} | - |
hour-step | number | 1 |
minute-step | number | 1 |
second-step | number | 1 |
is-range | boolean | false |
is-read-only | boolean | false |
is-disabled | boolean | false |
is-clearable | boolean | true |
is-invalid | boolean | false |
use-portal | boolean | false |
is-inline | boolean | false |
is-not-clickable | boolean | false |
is-sisable-header | boolean | false |
is-show-shortcut | boolean | false |
is-show-hour | boolean | true |
is-show-minute | boolean | true |
is-show-second | boolean | true |
is-use-12h | boolean | false |
disabled-date | (date: Date) => boolean | () => {} |
disabled-month | (month: number, year: number) => boolean | () => {} |
disable-year | (year: number) => boolean | () => {} |
disabled-time | (date: Date) => boolean | () => {} |
Basic
Type
TimePicker
Disabled Date
Range
Override Locale
You can override some of default locale with lang prop.
js
{
// the locale of formatting and parsing function
formatLocale: {
// MMMM
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
// MMM
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
// dddd
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
// ddd
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
// dd
weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
// first day of week
firstDayOfWeek: 0,
// first week contains January 1st.
firstWeekContainsDate: 1,
// format 'a', 'A'
meridiem: (h: number, _: number, isLowercase: boolean) {
const word = h < 12 ? 'AM' : 'PM';
return isLowercase ? word.toLocaleLowerCase() : word;
},
// parse ampm
meridiemParse: /[ap].?m?.?/i,
// parse ampm
isPM: (input: string) {
return input.toLowerCase().charAt(0) === 'p';
}
},
// the calendar header, default formatLocale.weekdaysMin
days: [],
// the calendar months, default formatLocale.monthsShort
months: [],
// the calendar title of year
yearFormat: 'YYYY 年',
// the calendar title of month
monthFormat: 'MMM',
// the calendar title of month before year
monthBeforeYear: false,
todayText: 'Today',
thisMonthText: 'This Month',
thisYearText: 'This Year'
}