Skip to content

Commit

Permalink
Fikset tid på post, så det går an å ha over en time
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus committed Nov 10, 2020
1 parent c7fbf42 commit 74efa8a
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/Frontend/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,9 @@ export const selectGroups = ({ groups }, lang) => {

const calculateEndTime = (startTime, minUsed) => {
const hours_min = startTime.split(":");
let hours = Math.floor((parseInt(minUsed) + parseInt(hours_min[1])) / 60);

let min = parseInt(hours_min[1]) + parseInt(minUsed);
if (!(min < 60)) {
min -= 60;
}
if (min < 10){
min = "0" + min
}
let final_hours = (parseInt(hours_min[0]) + hours) % 24;
if (final_hours < 10 ) {
final_hours = "0" + final_hours;
}
const final = final_hours + ":" + min;

return final;

let end_hour = parseInt(hours_min[0]) + Math.floor((parseInt(hours_min[1])+ parseInt(minUsed)) / 60);
let end_minute = (parseInt(hours_min[1]) + parseInt(minUsed)) % 60;
return `${end_hour < 10 ? "0" : ""}${end_hour}:${end_minute < 10 ? "0" : ""}${end_minute}`
}

export const mapTimeOnPosts = (event, sortedPosts) => {
Expand Down

0 comments on commit 74efa8a

Please sign in to comment.