microsoft / Recognizers-Text

Microsoft.Recognizers.Text provides recognition and resolution of numbers, units, date/time, etc. in multiple languages (ZH, EN, FR, ES, PT, DE, IT, TR, HI, NL. Partial support for JA, KO, AR, SV). Packages available at: https://www.nuget.org/profiles/Recognizers.Text, https://www.npmjs.com/~recognizers.text
MIT License
1.66k stars 429 forks source link

Prioritize DD/MM/YYYY format over MM/DD/YYYY format in results for english datetime recognizer #3134

Closed Kevv-J closed 9 months ago

Kevv-J commented 1 year ago

Describe the bug Unable to prioritize non-US datetime format result (DD/MM/YYYY over MM/DD/YYYY) for ambiguous dates which can be interpreted as both DD/MM/YYYY and MM/DD/YYYY. example 10/08/2023 can be 10th Aug or 8th Oct

To Reproduce Steps to reproduce the behavior:

  1. Send "10/08/2023" as input to recognize_datetime()
  2. it recognizes the date as 2023-10-08 (YYYY-MM-DD ie: 8th October 2023)

Expected behavior For most English Speaking countries (non-US) it is expected to be interpreted as 2023-08-10 (ie: 10th August 2023)

Platform :

Additional context I am looking for a way to specify DD/MM/YYYY to be default format to be recognized along with common English phrases like "day after tomorrow" "yesterday" etc which work with "en-US"

tellarin commented 9 months ago

@Kevv-J This is already supported. You can pass en-UK or Culture.EnglishOthers to the recognizers and the DMY format will be prioritized.