m-date-picker
m-date-picker copied to clipboard
How to change the Date format "ordering" and how to change the Months and Days formats ?
How can we change the display Date from 'Y M D' to 'M D Y' and how can we use the formatMonth and formatDay please can we give us an example for those noobies like me in react native,
i need to display a date picker like this "April 10 2018"
i manage to change the months form number to names like this
`const months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
export function monthNumToName(monthNum) { return months[monthNum - 1] || ''; }`
<DatePicker rootNativeProps={{'data-xx': 'yy'}} defaultDate={now} mode={'date'} locale={enUs} //maxDate={maxDate} //minDate={minDate} onDateChange={()=>{}} onValueChange={()=>{}} onScrollChange={()=>{}} formatMonth={ (month, date) => {return monthNumToName(month+1)}} // use12Hours />
but still i can't change the date format
i just look into the code and noticed that you are no date formation for reordering the way the date is displaying like 'M D Y' and you are using the following way to get the years , months and days
var _getValueCols = this.getValueCols(),
value = _getValueCols.value,
cols = _getValueCols.cols;
i hope you add the ability to change the order of the dates fileds it will be much helpful
For anyone who wants to display date pickers in custom order, like month -> day -> year for example, easy hack is to declare order css property on rmc-picker elements, like so:
.rmc-date-picker {
& .rmc-picker:nth-child(1) {
order: 2;
}
& .rmc-picker:nth-child(2) {
order: 0;
}
& .rmc-picker:nth-child(3) {
order: 1;
}
}
@avinograd0v, where should I write the css? could you tell me the file name?
I am using react native
The same issue. How to change the date format order like MM/DD/YYYY?