import React from 'react';
import { Select } from 'antd';

const Option = Select.Option;
const d = new Date();
const thisYear = d.getFullYear();

const theOption = [];

for (let i = thisYear; i >= 1950; i--) {
    theOption.push(<Option key={i.toString()} value={i.toString()}>{i}</Option>)
};

const Yearselect = React.createClass({
    onChange(e){
        this.props.handleyear(e);
    },
    render() {
        return (
            <Select className="year-select" onChange={this.onChange}>
                {theOption}
            </Select>
        )
    }
});

export default Yearselect;