-
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
c4a622b
commit 90d7a70
Showing
6 changed files
with
90 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import format from 'date-fns/format' | ||
|
||
const datePtBrFull = (date) => { | ||
const _date = new Date(date) | ||
|
||
if(!date) return false | ||
let d = date.replace("T", " ") | ||
let _y = d.split('-') | ||
let _d = _y[2].split(' ') | ||
let _t = _d.length > 1 ? _d[1].split(':') : [0, 0] | ||
let _date = new Date(_y[0], _y[1] - 1, _d[0], _t[0], _t[1]) | ||
|
||
if(!(_date instanceof Date)) | ||
return false | ||
|
||
return `${format(_date, "dd/MM/yyyy")} às ${format(_date, "HH:mm")}` | ||
} | ||
export default datePtBrFull |
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