Javascript 如何为react big calendar(fullcalendar.js)设置momentLocalizer(矩.js)?
我正在使用 需要帮助实施所需的本地化 git中的示例Javascript 如何为react big calendar(fullcalendar.js)设置momentLocalizer(矩.js)?,javascript,reactjs,momentjs,Javascript,Reactjs,Momentjs,我正在使用 需要帮助实施所需的本地化 git中的示例 import BigCalendar from 'react-big-calendar'; import moment from 'moment'; BigCalendar.setLocalizer( BigCalendar.momentLocalizer(moment) ); 我的代码 var moment = require('moment'); var momentLocalizer = require('react-widge
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
BigCalendar.setLocalizer(
BigCalendar.momentLocalizer(moment)
);
我的代码
var moment = require('moment');
var momentLocalizer = require('react-widgets/lib/localizers/moment');
import BigCalendar from 'react-big-calendar';
BigCalendar.setLocalizer(
BigCalendar.momentLocalizer(moment.locale('en'))
);
let MyCalendar = props => (
<div>
<BigCalendar
/>
</div>
);
var-moment=require('moment');
var momentLocalizer=require('react-widgets/lib/localizers/moment');
从“react big calendar”导入BigCalendar;
BigCalendar.setLocalizer(
BigCalendar.momentLocalizer(moment.locale('en'))
);
让我的日历=道具=>(
);
不管我做了什么,都没用
未捕获类型错误:力矩不是函数
下面是我的代码,它适合我。如果我想更改本地化,我只需在我的BigCalendar上设置
文化
道具
import React, { Component } from 'react';
import 'react-big-calendar/lib/css/react-big-calendar.css'
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
BigCalendar.momentLocalizer(moment);
class Calendar extends Component {
constructor(props, context) {
super(props, context);
}
render() {
return (
<div>
<BigCalendar
culture='en-GB'
events={this.props.tasks}
views={['month', 'week']}/>
</div>
);
}
}
import React,{Component}来自'React';
导入'react big calendar/lib/css/react big calendar.css'
从“react big calendar”导入BigCalendar;
从“力矩”中导入力矩;
BigCalendar.momentLocalizer(矩);
类日历扩展组件{
构造函数(道具、上下文){
超级(道具、背景);
}
render(){
返回(
);
}
}
我必须导入我想要在正确的区域设置中获取日历的区域设置
注意导入'moment/locale/nb'代码>
import React, { Component } from 'react';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
import 'moment/locale/nb';
import 'react-big-calendar/lib/css/react-big-calendar.css';
BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));
class Calendar extends Component {
constructor() {
super();
this.state = {
events: [],
};
}
render() {
return (
<div className="Calendar">
<BigCalendar
events={this.state.events}
/>
</div>
);
}
}
import React,{Component}来自'React';
从“react big calendar”导入BigCalendar;
从“力矩”中导入力矩;
导入“时刻/地点/注意事项”;
导入'react big calendar/lib/css/react big calendar.css';
BigCalendar.setLocalizer(BigCalendar.momentLocalizer(矩));
类日历扩展组件{
构造函数(){
超级();
此.state={
事件:[],
};
}
render(){
返回(
);
}
}
这适用于react big calendar的0.17.0版。cldr数据和全球化。。。这就是我必须安装的。谢谢你的帮助我有一个类似的问题:我想要我的大日历是英文的,但要自定义时区,而不是欧洲/伦敦。我怎样才能做到这一点?