Skip to content

Commit

Permalink
[#123] bugfix: parseInt
Browse files Browse the repository at this point in the history
  • Loading branch information
rosieyeon committed Feb 17, 2022
1 parent b576d93 commit 01e815d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/components/home/achievement/levelComponent.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import axios from 'axios';
import React from 'react';
import { useState, useEffect } from 'react';
import { Graph } from '../todays/homeStyle';
import '../../../statics/css/home/homeGoal.css';
import '../../../statics/css/home/levelComponent.css';
import axios from "axios";
import React from "react";
import { useState, useEffect } from "react";
import { Graph } from "../todays/homeStyle";
import "../../../statics/css/home/homeGoal.css";
import "../../../statics/css/home/levelComponent.css";

export default function LevelComponent(props) {
const levelImgUrl = 'https://i6a301.p.ssafy.io:8080/images/' + props.levelImg;
const TOKEN = localStorage.getItem('accessToken');
const levelImgUrl = "https://i6a301.p.ssafy.io:8080/images/" + props.levelImg;
const TOKEN = localStorage.getItem("accessToken");
const [dayTotalStudyTime, setDayTotalStudyTime] = useState(0);
var today = new Date();
var year = today.getFullYear();
var month = ('0' + (today.getMonth() + 1)).slice(-2);
var day = ('0' + today.getDate()).slice(-2);
var month = ("0" + (today.getMonth() + 1)).slice(-2);
var day = ("0" + today.getDate()).slice(-2);

var dateString = year + '-' + month + '-' + day;
var dateString = year + "-" + month + "-" + day;

var levelPercent = (
(props.timeTotal / (props.conditionToNext - props.levelCondition)) *
100
).toFixed(2);

var hour = (data) => {
return ('0' + Math.floor((data / 60) % 60)).slice(-2);
return ("0" + Math.floor((data / 60) % 60)).slice(-2);
};
var minute = (data) => {
return ('0' + Math.floor(data % 60)).slice(-2);
return ("0" + Math.floor(data % 60)).slice(-2);
};

useEffect(() => {
Expand Down Expand Up @@ -60,7 +60,7 @@ export default function LevelComponent(props) {
오늘 공부시간
</div>
<div className="level-component__stats__content-body">
{parseInt(dayTotalStudyTime / 60)}시간{' '}
{parseInt(dayTotalStudyTime / 60)}시간{" "}
{dayTotalStudyTime - parseInt(dayTotalStudyTime / 60) * 60}
</div>
</div>
Expand All @@ -69,7 +69,8 @@ export default function LevelComponent(props) {
총 공부시간
</div>
<div className="level-component__stats__content-body">
{hour(props.timeTotal)}시간 {minute(props.timeTotal)}
{parseInt(props.timeTotal / 60)}시간{" "}
{props.timeTotal - parseInt(props.timeTotal / 60) * 60}
</div>
</div>
<div className="level-component__stats__content">
Expand Down

0 comments on commit 01e815d

Please sign in to comment.