dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

customParseFormat: Add case insensitive search for `MMM` and `MMMM` format

Open eliandoran opened this issue 3 years ago • 2 comments

Parsing date inputs such as 21-December-18 (MMMM) and 2018 Feb 03 (MMM) works just fine, however as soon as the user enters inputs such as 21-december-18 or 2018 Feb 03, the date will not be parsed. This is especially the case for languages where it is not customary to write months with an upper case letter.

This PR implements a method which searches through the months with case insensitive.

Motivation for this PR: Was working on a application which parses user dates, but it would fail when users typed months using only small letters.

Initially wanted to implement case insensitive search only if strict mode is off, however it appears that case insensitivity is already handled in strict mode as well (see recognizes midnight in small letters test).

eliandoran avatar Jan 16 '22 20:01 eliandoran

Codecov Report

Merging #1769 (6f57e67) into dev (4a7b7d0) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev     #1769   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          179       179           
  Lines         1996      2002    +6     
  Branches       507       508    +1     
=========================================
+ Hits          1996      2002    +6     
Impacted Files Coverage Δ
src/plugin/customParseFormat/index.js 100.00% <100.00%> (ø)

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 4a7b7d0...6f57e67. Read the comment docs.

codecov[bot] avatar Jan 16 '22 20:01 codecov[bot]

fixes issue #1720

BePo65 avatar Jun 02 '22 15:06 BePo65