-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add timezone getter function in dateTime module [ATLAS-170] #125
base: master
Are you sure you want to change the base?
Conversation
… into feat/i18nify-data-alias
🦋 Changeset detectedLatest commit: 7b786b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Bundle Size Report
|
🟢 No Change | 🗑 File Deleted | 🆕 New File | 📈 Size Increased | 👍 Size Reduced |
---|
Parsed (kb) | |||||
---|---|---|---|---|---|
🚦 | File Name | Base | PR | Diff | % |
📈 | cjs/index.js |
146.22 |
150.42 |
|
2.87 |
📈 | esm/index.min.js |
52.8 |
53.96 |
|
2.2 |
📈 | umd/index.js |
166.76 |
171.25 |
|
2.69 |
This comment has been minimized.
This comment has been minimized.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #125 +/- ##
==========================================
+ Coverage 95.00% 95.08% +0.07%
==========================================
Files 44 47 +3
Lines 501 529 +28
Branches 128 130 +2
==========================================
+ Hits 476 503 +27
- Misses 24 25 +1
Partials 1 1 ☔ View full report in Codecov by Sentry. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…' into feat/dateTime-geo-data-migration
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
||
#### getTimeZoneByCountry(countryCode) | ||
|
||
`getTimeZoneByCountry` asynchronously fetches the time zone ⏰ for the capital city 🏙️ of a given country, using its country code 🌍. It's crafted for applications that require displaying or working with time zone-specific information 🕒 across different locations globally 🌎. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return timezones
too ?
* @returns A promise that resolves to the timezone of the capital city for the specified country code. | ||
* @throws Error if the country code is not found in the dynamically imported dataset or if there's an API response error. | ||
*/ | ||
const getTimeZoneByCountry = async (countryCode: string): Promise<string> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's return timezone list too ?
const timezone = | ||
data.metadata_information[countryCode]?.timezone_of_capital; | ||
|
||
if (!timezone) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this error be reported in catch block of promise ?
for eg,
getTimeZoneByCountry(IN).then().catch((err) => console.log(err)) ?
{}, | ||
); | ||
} catch (err) { | ||
throw new Error(`Error in API response: ${(err as Error).message}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it always have message attribute ?
name: string; | ||
} | ||
|
||
export interface CountryMetaType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in geo module, let's add this in common types.
…' into feat/dateTime-geo-data-migration
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Unit Test Results0 files 0 suites 0s ⏱️ Results for commit 7b786b6. |
Description
This PR introduces two getter functions for timezones in date time module along with their UT, E2E and README Docs.
Changes Made
List the main changes made in this pull request.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Additional Notes
Any additional information that would be helpful for the reviewer.
Checklist:
Reviewer Checklist
PR Title Format
Format:
<type>: <subject>
Types can be as follows:
feat
: (new feature for the user, not a new feature for build script)fix
: (bug fix for the user, not a fix to a build script)docs
: (changes to the documentation)style
: (formatting, missing semi colons, etc; no production code change)refactor
: (refactoring production code, eg. renaming a variable)test
: (adding missing tests, refactoring tests; no production code change)chore
: (updating grunt tasks etc; no production code change)