Skip to content

Commit

Permalink
Fix: Parse hh:mm:ss timestamps #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Nov 17, 2024
1 parent 18cfcc3 commit 332a13f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This is a small bug fix release.

### Changelog

- Fix: Parse hh:mm:ss timestamps #1370

***

## myMPD v18.2.1 (2024-11-15)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/js/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,15 @@ function getMyMPDuri(proto) {

/**
* Parses a string to seconds
* @param {string} value [hh:]mm:ss value to parse
* @param {string} value [hh:][mm:]ss value to parse
* @returns {number} value in seconds
*/
function parseToSeconds(value) {
let match = value.match(/(\d+):(\d+):(\d+)/);
if (match) {
return Number(match[1]) * 60 * 60 +
Number(match[1]) * 60 +
Number(match[2]);
Number(match[2]) * 60 +
Number(match[3]);
}
match = value.match(/(\d+):(\d+)/);
if (match) {
Expand Down

0 comments on commit 332a13f

Please sign in to comment.