Goal: Currently using react data grid, I want to keep user input in unified MM/DD/YYYY using the date picker (custom editor), and formats in user browser locale (custom formatter), is it possible to achieve.
(If I converts at the date picker format, I may need to modify the back end.)
I did some research of this post Using react-datepicker in react-data-grid compoent is it still true that formatter don't work with editor?
This is demo I built: https://codesandbox.io/embed/8l4jkor19
And I can't get formatter to work so far.
class DateFormatter extends React.Component {
render() {
const browserLocale =
window.navigator.userLanguage || window.navigator.language;
console.log("browserLocale is: " + browserLocale);
//{moment(this.props.value).local().locale(browserLocale).format('L')}
return <div>{moment(value).format("L")}</div>;
}
}
Any comments will be appreciate!