Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
List Changes Introduced by this PR
getHours(), getMinutes(), getSeconds()
methods to just usetoLocaleTimeString(...)
instead.Purpose
Describe the problem or feature in addition to a link to the issues.
getHours()
,getMinutes()
andgetSeconds()
which accurately return the number of hours, minutes, and seconds for that givenDate
object. However, it was not meant for display purposes and requires modification to display correctly.Approach
How does this change address the problem?
.toLocaleTimeString('en-US', { hour12: false })
to convert theDate
object tohh:mm:ss
. It was not specified whether this project was meant to be used for any locale other thanen-US
, so I made the decision to useen-US
and converted to 24-hour time to meet the specifiedhh:mm:ss
format.moment.js
; however, this would add additional functionality that would exceed the needs of the task and scope of the project OR I could have added a helper function to manually convert the time string to the correct readable format. UsingDate.toLocaleTimeString
seems to be the best fit here.Pre-Testing TODOs
What needs to be done before testing
Testing Steps
How do the users test this change?
/view-orders
page to see that the time value is displaying correctly.Learning
Describe the research stage
Date
object has and determinedtoLocaleTimeString
would best fit the needs of the task.Links to blog posts, patterns, libraries or addons used to solve this problem
Date
: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DatetoLocaleTimeString
: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeStringCloses Shift3#2