Skip to content

Commit 6f6bcad

Browse files
committed
Add notes on limitations of movieLength handling in convert function
1 parent 01db8a2 commit 6f6bcad

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎Sprint-2/3-mandatory-interpret/2-time-format.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@ return `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
5656
// e) The variable 'result' is a template literal syntax which holds the movie's length formatted as a colon-separated time string: as in '2:26:24'.
5757
// A better name for 'result' could have been 'movieLengthDisplay'
5858

59+
// f) This program did not work for all values of movieLength
60+
// Some problems discovered
61+
// - for movieLength 65 there was an issue with zero-padding, '65' becomes '0:1:5' instead of the conventional '00:01:05'. Returning single-digit minutes/seconds look wrong in a real time display
62+
// - negative integer, '-100', produced '0:-1:-40', which is inaccurate for a duration
63+
// - non-integer input, 90.5, was not handled as it gives '0:1:30.5'. This implies that a fractional second had slipped through untouched, since nothing was truncated.
64+
// - string input "8784" works here because operators '%', '-', and '/' automatically converts strings to numbers, but that is fragile and relies on the type conversion rather than actual input validation

0 commit comments

Comments
 (0)