xsoh / moment-hijri

A Hijri calendar (Based on Umm al-Qura calculations) plugin for moment.js
http://momentjs.com/docs/#/plugins/hijri/
MIT License
200 stars 82 forks source link

date.locale() returns undefined. Errors when using with antd DatePicker #43

Open ashgkwd opened 5 years ago

ashgkwd commented 5 years ago

If moment-hijri object is passed to DatePicker from antd as value prop; then DatePicker errors because return of value.locale() is undefined

minimal codes to reproduce

import moment from "moment-hijri";
import { DatePicker } from "antd";

export default const HijriDatePicker = (props) => {
  return <DatePicker value={props.value} format="DD-MM-YYYY (iDD-iMM-iYYYY)" />
}

Here is CodeSandbox link to test it live.