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

Improve Turkish parsing #1432

Conversation

lovelovedokidoki
Copy link
Contributor

Turkish parsing patterns is using default latin narrow pattern instead of one reflecting the first letters of Turkisk months, resulting in invalid dates for narrow format.

Also, for longer month formats, including that used in default date formats, the parsing values are not strict enough, resulting in may being read as march, and december being read as august.

Turkish still seems to have some issues, but this should enable parsing to be a bit more useful. (I am not a native Turkish speaker, just a RegEx nerd who needs the parser to work for long localized date format PPP)

@lovelovedokidoki
Copy link
Contributor Author

This proposed code change succeeds the unit tests proposed in #1423 for short P, medium PP, long PPP date format, and fails consequently full PPPP date format:

  tr, P format
    ✓ parse(29.11.2085) = 2085-11-29 (1ms)
    ✓ parse(14.07.2086) = 2086-7-14
    ✓ parse(06.01.2047) = 2047-1-6
    ✓ parse(22.03.2049) = 2049-3-22
    ✓ parse(09.09.2058) = 2058-9-9
    ✓ parse(28.10.2111) = 2111-10-28
    ✓ parse(12.08.2114) = 2114-8-12
    ✓ parse(08.06.2030) = 2030-6-8 (1ms)
    ✓ parse(10.12.2097) = 2097-12-10
    ✓ parse(02.08.2044) = 2044-8-2
  tr, PP format
    ✓ parse(6 Eyl 2085) = 2085-9-6
    ✓ parse(10 Mar 2092) = 2092-3-10
    ✓ parse(17 Haz 2097) = 2097-6-17
    ✓ parse(3 Nis 2100) = 2100-4-3 (1ms)
    ✓ parse(13 Eyl 2063) = 2063-9-13
    ✓ parse(30 Ara 2071) = 2071-12-30
    ✓ parse(18 Kas 2080) = 2080-11-18
    ✓ parse(7 Eyl 2095) = 2095-9-7
    ✓ parse(9 Kas 2028) = 2028-11-9
    ✓ parse(6 Eyl 2109) = 2109-9-6 (1ms)
  tr, PPP format
    ✓ parse(25 Şubat 2038) = 2038-2-25
    ✓ parse(18 Haziran 2043) = 2043-6-18
    ✓ parse(5 Nisan 2025) = 2025-4-5
    ✓ parse(26 Mayıs 2063) = 2063-5-26
    ✓ parse(23 Kasım 2049) = 2049-11-23 (1ms)
    ✓ parse(25 Mayıs 2034) = 2034-5-25
    ✓ parse(8 Ekim 2107) = 2107-10-8
    ✓ parse(19 Temmuz 2105) = 2105-7-19
    ✓ parse(17 Temmuz 2023) = 2023-7-17
    ✓ parse(1 Ekim 2106) = 2106-10-1
  tr, PPPP format
    ✕ parse(12 Ocak 2059 Pazar) = 2059-1-12 (2ms)
    ✕ parse(25 Mart 2026 Çarşamba) = 2026-3-25 (1ms)
    ✕ parse(25 Eylül 2047 Çarşamba) = 2047-9-25 (1ms)
    ✕ parse(11 Eylül 2085 Salı) = 2085-9-11 (1ms)
    ✕ parse(18 Nisan 2049 Pazar) = 2049-4-18 (11ms)
    ✕ parse(13 Mart 2049 Cumartesi) = 2049-3-13 (6ms)
    ✕ parse(17 Aralık 2045 Pazar) = 2045-12-17 (2ms)
    ✕ parse(16 Mayıs 2028 Salı) = 2028-5-16 (1ms)
    ✕ parse(27 Ekim 2032 Çarşamba) = 2032-10-27 (2ms)
    ✕ parse(8 Eylül 2063 Cumartesi) = 2063-9-8 (1ms)

Copy link
Member

@kossnocorp kossnocorp left a comment

Choose a reason for hiding this comment

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

Thank you so much for helping with that! The PR looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants