Skip to content

Commit

Permalink
Merge pull request #12 from KaylaKremer/update-version
Browse files Browse the repository at this point in the history
Update version
  • Loading branch information
KaylaKremer committed Jul 12, 2023
2 parents 27fb3af + 75317a2 commit 0d397c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Parse user-provided durations or timestamps (in decimal or hh:mm format) and get
In your project's directory, run:

```
npm install git+https://github.com/harvesthq/hour-parser.git#v2.0.0
npm install git+https://github.com/harvesthq/hour-parser.git#v2.1.0
```

## Usage
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ const toHHMM = (input) => {
const sign = total < 0 ? '-' : '';
total = Math.abs(total);
const hours = Math.floor(total / 60);
const minutes = Math.round(total) % 60;
let minutes = total % 60;
if (minutes >= 59.5 && minutes < 60) {
minutes = Math.floor(minutes);
}
else {
minutes = Math.round(minutes);
}
const paddedMinutes = minutes.toString().padStart(2, '0');
return `${sign}${hours}:${paddedMinutes}`;
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hour-parser",
"version": "2.0.0",
"version": "2.1.0",
"description": "Parse user-provided timestamp input and get nice output",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 0d397c5

Please sign in to comment.