Skip to content

Conversation

@SuyashSingh01
Copy link
Contributor

@SuyashSingh01 SuyashSingh01 commented Sep 24, 2025

Related Issues

Related Issue: Dxp-371
Issue Link: hotwax/dxp-components#371

Short Description and Why It's Useful

Improved and added the current timezone support in the setting page and timezonemodal.

Screenshots of Visual Changes before/after (If There Are Any)

Screenshot from 2025-10-17 20-16-53 Screenshot from 2025-10-17 20-16-40 Screenshot from 2025-10-17 20-16-16

Contribution and Currently Important Rules Acceptance

@dt2patel
Copy link
Contributor

@gemini-code-assist review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces the display of the browser's time zone in the TimezoneModal and Settings components, enhancing the user experience by providing immediate context of their current time zone. It also includes the functionality to display the current time for selected time zones. The code changes are well-structured and improve the usability of the application. However, there are some areas where improvements can be made to enhance code clarity and efficiency.

let queryString = ref("")
let filteredTimeZones = ref([])
let timeZones = ref([])
let timeZones = computed(() => userStore.getTimeZones)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is recommended to use const instead of let for variables that are not reassigned after initialization. This improves code readability and helps prevent accidental reassignments.

const timeZones = computed(() => userStore.getTimeZones)
const timeZones = computed(() => userStore.getTimeZones)

}
if(props.showBrowserTimeZone) {
browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The optional chaining operator ?. is used after the find method. While this prevents errors if no matching time zone is found, it might be better to provide a default label in case timeZones.value is empty or the find method returns undefined. This will ensure that the UI always displays a valid label, even if it's a placeholder.

browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label || 'N/A';
browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label || 'N/A';

Comment on lines +142 to +144
if(props.showBrowserTimeZone) {
filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This filtering logic could be simplified by combining the conditions into a single filter operation. This reduces redundancy and makes the code more readable.

filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !props.showBrowserTimeZone || !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()));
filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !props.showBrowserTimeZone || !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants