python-bidi icon indicating copy to clipboard operation
python-bidi copied to clipboard

Unexpected results for dates containing single digit Arabic numerals

Open superbland opened this issue 8 years ago • 1 comments

A string passed to get_display in the format of dd month yyyy - dd month yyyy will yield different ordering if the day is a single digit.


OSX 10.11.6 Python 3.5.1 python-bidi 0.4.0


Steps to reproduce:

get_display('٢٦ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦')
'١٩٤٦ ليربأ ١٥-١٩٤٥ ربوتكأ ٢٦'
get_display('٢ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦')
'١٩٤٦ ليربأ ١٥-٢ أكتوبر ١٩٤٥'

Read from right to left, the above will generate:

  • yyyy month dd - yyyy month dd :white_check_mark:
  • yyyy month dd - d month yyyy :negative_squared_cross_mark:

My steps around this for now will be prepend single digit day values with a leading zero (٠), which gives me the consistent format I expect, however this seems like a bug to me?

superbland avatar Sep 28 '17 10:09 superbland

After installing python-bidi 0.4.2 the mistake does not occur anymore. get_display('٢ أكتوبر ١٩٤٥-١٥ أبريل ١٩٤٦') [Out:] '١٩٤٦ ليربأ ١٥-١٩٤٥ ربوتكأ ٢'

dkinitz avatar Feb 17 '20 13:02 dkinitz