Skip to content

Commit

Permalink
Last update
Browse files Browse the repository at this point in the history
  • Loading branch information
LMOlivera committed Apr 22, 2019
2 parents b2907ed + 18572d9 commit 3f5431b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/component/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class App extends React.Component{
name="date"
id="date"
value={this.state.dateValue}
max="2019-08-31"
min="2019-04-24"
onChange={(txt) => this.updateDateInputValue(txt)}
placeholder="yyyy-mm-dd"/>
Expand Down
17 changes: 10 additions & 7 deletions app/component/timer-component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class Timer extends React.Component{
try{
var inp = this.props.dateInput;//
var d = new Date(inp.toLocaleString());
d.setDate(d.getDate() + 1);
d.setDate(d.getDate() + 2);


d.setHours(0);

//*******Date*******
Expand All @@ -45,7 +47,7 @@ class Timer extends React.Component{

var hours = Math.floor(delta / 3600) % 24;
delta -= hours * 3600;

var minutes = Math.floor(delta / 60) % 60;
delta -= minutes * 60;

Expand Down Expand Up @@ -80,22 +82,23 @@ class Timer extends React.Component{
flag = true;
}
}
//console.log(extraHours);
hours+=extraHours;
minutes+=extraMins;

if (minutes>59){
hours+=1;
minutes-=60;
}

if (hours>23){
days += 1;
hours -= 24;
}

if (isNaN(minutes) || isNaN(hours)){
throw "Incorrect output";
}
days-=1;
this.setState({
days: days,
hours: hours,
Expand All @@ -107,8 +110,7 @@ class Timer extends React.Component{
this.setState({
show: false
});
}

}
}

render(){
Expand All @@ -118,10 +120,11 @@ class Timer extends React.Component{
to watch Endgame.
<InputName days={this.state.days} hours={this.state.hours} minutes={this.state.minutes} seconds={this.state.seconds} dateInput={this.props.dateInput} timeInput={this.props.timeInput}/>
</p>;
const itsTime = <p><b>GO WATCH ENDGAME!!!</b></p>;
return(
<div>
<center><button className="btn" type="button" onClick={() => this.loop()}><text>How much do I have to wait?</text></button></center>
{this.state.show ? timer : ''}
{this.state.show ? (this.state.days <= -1 ? itsTime : timer) : ''}
</div>
);
}
Expand Down
Loading

0 comments on commit 3f5431b

Please sign in to comment.