Skip to content

Conversation

@harsh9200
Copy link

@harsh9200 harsh9200 commented Mar 22, 2020

fixes #502

Before:

>>> dateparser.parse("now")
datetime.datetime(2020, 3, 23, 0, 32, 3, 521286)

>>> dateparser.parse("10 days from now")

After:

>>> dateparser.parse("now")
datetime.datetime(2020, 3, 23, 0, 32, 3, 521286)

>>> dateparser.parse("10 days from now")
datetime.datetime(2020, 4, 2, 0, 32, 11, 25878)

@codecov
Copy link

codecov bot commented Mar 22, 2020

Codecov Report

Merging #642 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #642      +/-   ##
==========================================
- Coverage   95.21%   95.21%   -0.01%     
==========================================
  Files         302      302              
  Lines        2507     2506       -1     
==========================================
- Hits         2387     2386       -1     
  Misses        120      120              
Impacted Files Coverage Δ
dateparser/data/date_translation_data/en.py 100.00% <ø> (ø)
dateparser/date.py 97.96% <0.00%> (-0.01%) ⬇️

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 fb188b6...048aa9f. Read the comment docs.

@harsh9200
Copy link
Author

Any particular reason why this is failing?

@Gallaecio
Copy link
Member

Don’t mind the project coverage test. The tests pass and you have covered your changes with tests.

Copy link
Member

@Gallaecio Gallaecio left a comment

Choose a reason for hiding this comment

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

Have you seen https://dateparser.readthedocs.io/en/latest/contributing.html#guidelines-for-editing-translation-data ? I think you may have missed some steps. Also applies to #638 and #650.

@harsh9200
Copy link
Author

I am getting this Error @Gallaecio

C:\Users\hagar\dateparser>python scripts/write_complete_data.py
Traceback (most recent call last):
  File "scripts/write_complete_data.py", line 115, in <module>
  File "scripts/write_complete_data.py", line 79, in main
  File "scripts/write_complete_data.py", line 58, in _get_complete_date_translation_data
  File "E:\Softwares\Python\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "E:\Softwares\Python\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 80: character maps to <undefined>

@harsh9200
Copy link
Author

I changed the following wherever the error occurred in scripts/write_complete_data.py

with open(cldr_date_directory + language + '.json') as f:
with open(cldr_date_directory + language + '.json', 'rb') as f:`

Is this the right way?

@Gallaecio
Copy link
Member

Is this the right way?

In cases where the read data goes into json.loads, I think that change is correct.

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.

"x days from now" relative no longer functions as of 0.7

2 participants