forked from regentmarkets-repo-archive/binary-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDobYear.js
More file actions
24 lines (21 loc) · 635 Bytes
/
DobYear.js
File metadata and controls
24 lines (21 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React, { PureComponent } from 'react';
import { sequence } from 'binary-utils';
export default class DobYear extends PureComponent {
props: {
year: number,
onYearChange: (e: SyntheticEvent) => void,
}
render() {
const { year, onYearChange } = this.props;
const years = sequence(80);
const lastValidYear = new Date().getFullYear() - 18;
return (
<select id="dobyy" name="dobyy" defaultValue={year} onChange={onYearChange}>
<option disabled>Year</option>
{years.map((o: number, i: number) => (
<option key={i} value={lastValidYear - i}>{lastValidYear - i}</option>
))}
</select>
);
}
}