-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c94b708
commit 217ba03
Showing
6 changed files
with
114 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* * */ | ||
/* PARSE TIME STRING TO DATE */ | ||
/* Explanation needed. */ | ||
/* * */ | ||
|
||
export default function parseTimeStringToDate(timeString = '' /* HH:MM:DD */) { | ||
if (!timeString.length === 8) return null; | ||
// Extract hours, minutes, and seconds from the string | ||
const timeStringParts = timeString.split(':'); | ||
const hours = parseInt(timeStringParts[0]); | ||
const minutes = parseInt(timeStringParts[1]); | ||
const seconds = parseInt(timeStringParts[2]); | ||
// Create a new Date object with the extracted components | ||
const dateObject = new Date(); | ||
dateObject.setHours(hours); | ||
dateObject.setMinutes(minutes); | ||
dateObject.setSeconds(seconds); | ||
// Create a new Date object with the extracted components | ||
return dateObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters