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

Optimizing remainingTime module #357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thevilx
Copy link

@thevilx thevilx commented Jan 20, 2024

I've eliminated the unnecessary calculation in this section. Instead, I've utilized the RemainingTime object to assess whether a specific field exceeds zero. If it does, the corresponding value is added to the result: string[]. Later, these values are combined using result.join(" و ").

const remainingTimeInSeconds =
		years * secondsInYear +
		months * secondsInMonth +
		days * secondsInDay +
		hours * secondsInHour +
		minutes * secondsInMinute;

I've further improved the code by eliminating the need for the convertToFaDigit() function. Instead, I've incorporated digitsEnToFa() immediately after combining the results into a string. This approach eliminates the manual conversion of each number within the RemainingTime object, streamlining the process for better efficiency and code simplicity.

@ghost
Copy link

ghost commented Jan 20, 2024

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@thevilx
Copy link
Author

thevilx commented Feb 3, 2024

@ali-master Would you please review my PR?

@mediv0 mediv0 self-requested a review February 20, 2024 17:53
Copy link
Member

@mediv0 mediv0 left a comment

Choose a reason for hiding this comment

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

LGTM
ty

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.

None yet

2 participants