-
Notifications
You must be signed in to change notification settings - Fork 141
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
yuannnh
committed
Feb 5, 2020
1 parent
da013bc
commit 100b089
Showing
2 changed files
with
32 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// 目前的时间格式为 hh:mm 的 String, 该方法将其转化为当天的该时间 | ||
export const getTimeFromTimeStr = (timeStr:string) => { | ||
const [hours, minutes] = timeStr.split(':').map(parseInt) | ||
const time = new Date(); | ||
if(hours){ | ||
time.setHours(hours); | ||
} | ||
if(minutes) { | ||
time.setMinutes(minutes) | ||
} | ||
return time; | ||
} | ||
|
||
|
||
|