Skip to content

Commit

Permalink
Merge pull request #240 from xgfe/revert-234-moment-with-locales
Browse files Browse the repository at this point in the history
Revert "Use moment with locales"
  • Loading branch information
feyy authored Apr 22, 2018
2 parents 5975648 + d9d243b commit 05c2f30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
9 changes: 1 addition & 8 deletions __tests__/Datepicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {Platform, Animated, DatePickerAndroid, Modal, View} from 'react-native';
import Enzyme, {shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Moment from 'moment/min/moment-with-locales';
import Moment from 'moment';
import DatePicker from '../datepicker.js';

Enzyme.configure({adapter: new Adapter()});
Expand Down Expand Up @@ -354,11 +354,4 @@ describe('Coverage', () => {

wrapper.find('DatePickerIOS').simulate('dateChange');
});

it('Sets locale', () => {
jest.spyOn(Moment, 'locale');
shallow(<DatePicker locale="es" />);

expect(Moment.locale).toHaveBeenCalledWith('es');
});
});
8 changes: 1 addition & 7 deletions datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Keyboard
} from 'react-native';
import Style from './style';
import Moment from 'moment/min/moment-with-locales';
import Moment from 'moment';

const FORMATS = {
'date': 'YYYY-MM-DD',
Expand Down Expand Up @@ -50,12 +50,6 @@ class DatePicker extends Component {
this.setModalVisible = this.setModalVisible.bind(this);
}

componentDidMount() {
if (this.props.locale) {
Moment.locale(this.props.locale);
}
}

componentWillReceiveProps(nextProps) {
if (nextProps.date !== this.props.date) {
this.setState({date: this.getDate(nextProps.date)});
Expand Down

0 comments on commit 05c2f30

Please sign in to comment.