Recognizers-Text icon indicating copy to clipboard operation
Recognizers-Text copied to clipboard

[Javascript | EN DateTime V2] '.' and '/' as MM-DD-YY delimiters cause different resolution logic

Open apolya01 opened this issue 5 years ago • 0 comments

Describe the bug Dates with '.' delimiter follow different convention for resolution than dates with '/' delimiter: '.' is parsed as DD-MM-YYYY and '/' is parsed as MM-DD-YYYY

To Reproduce Steps to reproduce the behavior:

  • Call Recognizers.recognizeDateTime("12.4.20", Recognizers.Culture.English)
  • Observe that results[0].resolution.values[0] has 'value' field of "2020-04-12"
  • Call Recognizers.recognizeDateTime("12/4/20", Recognizers.Culture.English)
  • Observe that results[0].resolution.values[0] has 'value' field of "2020-12-04"

Expected behavior Phrases differing only by delimiter should be consistent in thier resolution

Sample input/output Recognizers.recognizeDateTime("12.4.20", Recognizers.Culture.English)

{
  values: [
    {
      timex: "2020-04-12",
      type: "date",
      value: "2020-04-12",
    },
  ],
}

Recognizers.recognizeDateTime("12/4/20", Recognizers.Culture.English)

{
  values: [
    {
      timex: "2020-12-04",
      type: "date",
      value: "2020-12-04",
    },
  ],
}

Platform (please complete the following information):

  • Platform: Javascript
  • Environment: npm package
  • Version of package 1.3.0

apolya01 avatar Dec 04 '20 17:12 apolya01