forked from inno-v/react-date-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.jsx
169 lines (136 loc) · 3.81 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
'use strict'
// require('./index.css')
// require('./theme/hackerone.css')
//
require('./style/index.scss')
import {findDOMNode} from 'react-dom'
global.findDOMNode = findDOMNode
import DateFormatInput from './src/DateFormatInput'
import MonthView from './src/MonthView'
import DatePicker from './src/Calendar'
import TimePicker from './src/TimePicker'
import TimeInput from './src/TimeInput'
import TransitionView from './src/TransitionView'
import DecadeView from './src/DecadeView'
import YearView from './src/YearView'
import HistoryView from './src/HistoryView'
import NavBar from './src/NavBar'
import Calendar from './src/Calendar'
import Footer from './src/Footer'
import MultiMonthView from './src/MultiMonthView'
import BasicMonthView from './src/BasicMonthView'
import DateField from './src/DateField'
import Clock from './src/Clock'
import DateFormatSpinnerInput from './src/DateFormatSpinnerInput'
import { Flex, Item } from 'react-flex'
var moment = require('moment');
var React = require('react')
var render = require('react-dom').render
var range = ['2016-05-01', '2016-05-09']
var date = moment().add(-10, 'days')
var LOCALE = 'en'
var TODAY = {
en: 'Today',
fr: 'Aujourd\'hui',
de: 'Heute',
es: 'Hoy',
ro: 'Azi'
}
class F extends React.Component {
render(){
const onClick = () => {
this.props.selectDate({dateMoment: moment('14/10/2016','DD/MM/YYYY')})
}
return <div onClick={onClick}>
Select
</div>
}
}
F.defaultProps = {
isDatePickerFooter: true
}
var GO2SELECTED = {
en: 'Go to selected',
es: 'Vaya a Favoritos',
de: 'Zum ausgewählten',
fr: 'Aller a la liste',
ro: 'Mergi la selectie'
}
function emptyFn(){}
let R = range
var App = React.createClass({
displayName: 'App',
onLocaleChange: function(event) {
LOCALE = event.target.value
this.setState({})
},
getInitialState(){
return {
date: '2016-10-03',
text: 'atext',
time: '03:45:21 pm'
}
},
onTimeChange(time){
// console.log('time', time)
this.setState({ time })
},
onChange(date){
this.setState({
date
})
},
onTextChange(text){
this.setState({
text
})
},
render: function(){
range = this.props.range || range
date = this.props.date || date
return <div style={{margin: 10}}>
{/*<DateField pattern={false} dateFormat="YYYY MM DD" />
<TransitionView transitionDuration="0.1s">
<MonthView dateFormat="DD/MM/YYYY" defaultDate="20/04/2016" onChange={() => {}}/>
</TransitionView>
<br />
*/}
{/*<TimeInput format="hh:mm:ss A" xonChange={this.onTimeChange} defaultValue={this.state.time}/>*/}
{/*<DateField
defaultValue={"2016-05-30"}
dateFormat="YYYY-MM-DD"
/>
<br />
<TimePicker timeFormat="HH:mm:ss" defaultTime style={{minHeight: 200, minWidth: 200}}/>
<br />*/}
<HistoryView maxDate={Date.now()} />
<MonthView
dateFormat="YYYY-MM-DD"
onChange={(dateFormat, {dateMoment}) => {
console.log(dateFormat, '!!!');
}}
placeholder="test"
defaultRange={[]}
isDisabledDay={() => false}
>
</MonthView>
{<TransitionView>
<MultiMonthView highlightRangeOnMouseMove defaultRange={[]} size={4}
/></TransitionView>}
<br />
</div>
},
onRangeChange: function(range, r){
if (r.length){
if (r[1].timestamp - r[0].timestamp < 1000 * 60 *60*24 * 3)
return range[0]
}
// console.log(range)
R = range
this.setState({})
//range = rangeValue
//date = rangeValue
//this.setState({})
}
})
render(<App />, document.getElementById('content'))