-
Notifications
You must be signed in to change notification settings - Fork 113
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 remainingTime function #116
feat: ✨ add remainingTime function #116
Conversation
Codecov Report
@@ Coverage Diff @@
## master #116 +/- ##
==========================================
+ Coverage 92.17% 92.71% +0.54%
==========================================
Files 40 42 +2
Lines 626 673 +47
Branches 162 169 +7
==========================================
+ Hits 577 624 +47
Misses 49 49
Continue to review full report at Codecov.
|
Thanks for contributing. I really enjoyed it. Review in progress... |
Please prevent using emojis in your commits! |
OK. Do you want me to rebase the branch and change existing commits? |
I think the function name should be |
You are right my friend. That's the name we should use. |
src/modules/remainingTime/index.ts
Outdated
|
||
const Seconds = remainedTime; | ||
const Seconds = remainingTime; | ||
|
||
return { | ||
Years, |
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.
Please convert all return keys to camelCase
here and everywhere you've written.
src/index.ts
Outdated
// RemainedTime | ||
export { default as RemainedTime } from "./modules/remainedTime"; | ||
// RemainingTime | ||
export { default as RemainingTime } from "./modules/remainingTime"; |
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.
please convert every single variable of your code to the camelCase
convention.
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.
Converted all the variables.
* @returns convert years, months, days, hours, minutes and seconds to farsi digits and return them in an object with keys: | ||
* `faYears`, `faMonths`, `faHours`, `faMinutes`, `faSeconds` | ||
*/ | ||
const convertToFaDigit = ( |
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.
add this function to your test file and remove the fa
prefix.
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 function is used in toString
implementation.
test/remainingTime.spec.ts
Outdated
expect(RemainingTime("2023-05-14T13:35:59Z").toString()).toBe( | ||
"۱ سال و ۱ ماه و ۲ روز و ۳ ساعت و ۵ دقیقه و ۸ ثانیه", | ||
); | ||
expect(RemainingTime("2022-05-14T13:35:59Z").toString()).toBe("۱ ماه و ۲ روز و ۳ ساعت و ۵ دقیقه و ۸ ثانیه"); |
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.
please prettify your code and make sure the prettier
plugin has been installed on your IDE or code editor.
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.
The extension is installed. Also ran npm run prettier
before shipping my commit.
@ali-master salam Ali jan. ye modate in tagheerat ro zadam. forsat nakardi bebini? |
سلام پورشاد جان عذرخواهی میکنم بابت تاخیر در جوابم، |
This function calculates remained years, months, days, hours, mintutes and seconds to a specific date
we already checked this phrase so we can simply set is
make conditions more readable by using remainedTimeInSeconds
04f4488
to
7fa936d
Compare
درود بر شما. مشکلی نیست. سلامت باشی ایشالا |
This function calculates remained years, months,
days, hours, mintutes and seconds to a specific date