fix: formatDate working with timezone code
This commit is contained in:
parent
0429563e42
commit
78a4c9f267
8 changed files with 17 additions and 25 deletions
|
|
@ -74,10 +74,12 @@ const getTzLabels = timezones =>
|
|||
getFinalTimezones(timezones)
|
||||
)
|
||||
|
||||
const formatDate = (date, offset, format) =>
|
||||
moment
|
||||
const formatDate = (date, timezoneCode, format) => {
|
||||
const dstOffset = timezoneCode.split(':')[1]
|
||||
return moment
|
||||
.utc(date)
|
||||
.utcOffset(offset)
|
||||
.utcOffset(parseInt(dstOffset))
|
||||
.format(format)
|
||||
}
|
||||
|
||||
export { getTzLabels, formatDate }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue