Skip to content

add date_to_weekday finder method #4599

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

Merged
merged 10 commits into from
Aug 18, 2021
Merged

add date_to_weekday finder method #4599

merged 10 commits into from
Aug 18, 2021

Conversation

suryapratapsinghsuryavanshi
Copy link
Contributor

Describe your change:

  • Add an algorithm?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@ghost ghost added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Aug 7, 2021
@ghost ghost removed the tests are failing Do not merge until tests pass label Aug 7, 2021
day, month, year = [int(x) for x in inp_date.split("/")]
if year % 100 == 0:
year = "00"
new_base_date: str = f"{day}/{month}/{year%100} 23:15:59"
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need a time here.

>>> date_to_weekday("1/1/2021")
'Friday'
"""
day_list: list = [
Copy link
Member

Choose a reason for hiding this comment

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

We have pretty module in python so we don't need to hardcode weekdays import calendar;calendar.day_name

@ghost ghost added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels Aug 10, 2021
@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed awaiting changes A maintainer has requested changes to this PR labels Aug 13, 2021
@ghost ghost added the tests are failing Do not merge until tests pass label Aug 13, 2021
Copy link
Member

@l3str4nge l3str4nge left a comment

Choose a reason for hiding this comment

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

Tests are failing

@ghost ghost added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels Aug 14, 2021
@suryapratapsinghsuryavanshi
Copy link
Contributor Author

Yes, but I don't get a reason why the tests are failing.

@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed awaiting changes A maintainer has requested changes to this PR tests are failing Do not merge until tests pass labels Aug 18, 2021
@l3str4nge l3str4nge merged commit 9cb5760 into TheAlgorithms:master Aug 18, 2021
@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Aug 18, 2021
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* add date_to_weekday finder method

* reformat date_to_weekday method

* remove time

* remove hardcode weekdays list

* fix return type error

* fixing fail issue

* Finding the test failing issue

* after testing the pre-commit in local environment
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