Skip to content
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

Merged
merged 8 commits into from
Dec 31, 2021

Conversation

pshaddel
Copy link
Contributor

This function calculates remained years, months,
days, hours, mintutes and seconds to a specific date

@codecov
Copy link

codecov bot commented Sep 17, 2021

Codecov Report

Merging #116 (e30d505) into master (d46272c) will increase coverage by 0.54%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
src/modules/remainingTime/getCurrentDateTime.ts 100.00% <100.00%> (ø)
src/modules/remainingTime/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d46272c...e30d505. Read the comment docs.

@ali-master ali-master self-requested a review September 17, 2021 10:53
@ali-master ali-master added the New feature Something new label Sep 17, 2021
@ali-master ali-master linked an issue Sep 17, 2021 that may be closed by this pull request
@ali-master ali-master removed a link to an issue Sep 17, 2021
@ali-master
Copy link
Member

Thanks for contributing. I really enjoyed it.

Review in progress...

@ali-master
Copy link
Member

Please prevent using emojis in your commits!

@pshaddel
Copy link
Contributor Author

Please prevent using emojis in your commits!

OK. Do you want me to rebase the branch and change existing commits?

@ShahriarKh
Copy link

I think the function name should be remainingTime instead of remainedTime

@pshaddel
Copy link
Contributor Author

I think the function name should be remainingTime instead of remainedTime

You are right my friend. That's the name we should use.
Checkout my last commit.

@pshaddel pshaddel changed the title feat: ✨ add remainedTime function feat: ✨ add remainingTime function Sep 29, 2021

const Seconds = remainedTime;
const Seconds = remainingTime;

return {
Years,
Copy link
Member

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";
Copy link
Member

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.

Copy link
Contributor Author

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 = (
Copy link
Member

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.

Copy link
Contributor Author

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.

expect(RemainingTime("2023-05-14T13:35:59Z").toString()).toBe(
"۱ سال و ۱ ماه و ۲ روز و ۳ ساعت و ۵ دقیقه و ۸ ثانیه",
);
expect(RemainingTime("2022-05-14T13:35:59Z").toString()).toBe("۱ ماه و ۲ روز و ۳ ساعت و ۵ دقیقه و ۸ ثانیه");
Copy link
Member

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.

Copy link
Contributor Author

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.

@pshaddel
Copy link
Contributor Author

@ali-master salam Ali jan. ye modate in tagheerat ro zadam. forsat nakardi bebini?

@moh3n9595 moh3n9595 linked an issue Dec 27, 2021 that may be closed by this pull request
@ali-master
Copy link
Member

@ali-master salam Ali jan. ye modate in tagheerat ro zadam. forsat nakardi bebini?

سلام پورشاد جان

عذرخواهی میکنم بابت تاخیر در جوابم،
لطفا کانفلیکتی که به وجود اومده رو برطرف کن و بعدش یکبار دیگه تست ها رو کامل اجراء کن و اگر همه چیز اوکی بود، مرج میکنم و نسخه جدید رو پابلیش میکنم.

@pshaddel
Copy link
Contributor Author

pshaddel commented Dec 31, 2021

@ali-master salam Ali jan. ye modate in tagheerat ro zadam. forsat nakardi bebini?

سلام پورشاد جان

عذرخواهی میکنم بابت تاخیر در جوابم، لطفا کانفلیکتی که به وجود اومده رو برطرف کن و بعدش یکبار دیگه تست ها رو کامل اجراء کن و اگر همه چیز اوکی بود، مرج میکنم و نسخه جدید رو پابلیش میکنم.

درود بر شما. مشکلی نیست. سلامت باشی ایشالا
کانفلیکت حل شد و تست ها به سلامت سپری شدند

@ali-master ali-master merged commit 9989cd5 into persian-tools:master Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature Something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persian Remained Time
3 participants