Refactor getTimezoneAbbreviation function in date utility for improved readability and efficiency.
This commit is contained in:
@@ -46,11 +46,7 @@ export const getAdjustedTime = (): Moment => {
|
||||
};
|
||||
|
||||
export const getTimezoneAbbreviation = (date: Date): string => {
|
||||
const timezone = date
|
||||
.toString()
|
||||
.match(/\(.+\)/g)?.[0] ?? ''
|
||||
.replace('(', '') ?? ''
|
||||
.replace(')', '');
|
||||
const timezone = date.toString().match(/\(.+\)/g)?.[0] ?? ''.replace('(', '') ?? ''.replace(')', '');
|
||||
let abbreviation = '';
|
||||
|
||||
timezone.split(' ').forEach(word => {
|
||||
|
||||
Reference in New Issue
Block a user