gr2m / moment-parseformat

A moment.js plugin to extract the format of a date/time string
http://gr2m.github.io/moment-parseformat
Apache License 2.0
45 stars 30 forks source link

fix: 10/8/2014 5:08:35 PM → M/D/YYYY h:mm:ss a (#20) #21

Closed harsimranb closed 9 years ago

harsimranb commented 9 years ago
  1. Added a new function appendAMPMCase(); which appends the correct case for the time period based on the AM/pm case in the date string.
  2. Added a new test to the index.html page for this change.
gr2m commented 9 years ago

Thanks, looks good!

Could you please also add a test to tests/moment.parseFormat-test.js? You can run tests with grunt test. If you haven't yet, you need to install grunt with npm install -g grunt-cli and install the npm dependencies with npm install before.

Tests could look like this:

  // https://github.com/gr2m/moment.parseFormat/issues/20
  equal( moment.parseFormat('10/8/2014 5:08:35 PM'), 'M/D/YYYY h:mm:ss A', '#20 10/8/2014 5:08:35 PM → M/D/YYYY h:mm:ss A' );
  equal( moment.parseFormat('10/8/2014 5:08:35am'), 'M/D/YYYY h:mm:ssa', '#20 10/8/2014 5:08:35 am → M/D/YYYY h:mm:ssa' );
gr2m commented 9 years ago

merged via bd9a73d, cheers :+1: