canvas-lms/packages/datetime-moment-parser
Ahmad Amireh 7d9bacbde8 extract @canvas/timezone into a package
refs FOO-1891

DateTime parsing and formatting is now provided by the package datetime,
which is now the only module that interfaces with the timezone package.
Date math and utilities can now reside in the @canvas/datetime package,
which are free to utilize the parse and format routines as necessary.

    * packages/datetime: base parse & format routines
    * packages/datetime-moment-parser: a transitive dep of
      packages/datetime; used exclusively by it
    * ui/shared/datetime: canvas-specific math & utilities
    * ui/shared/timezone: deprecated and set to be removed later

Like datetime-moment-parser, datetime is configured in an initializer to
provide it with parameters coming from Canvas locale files as it is
no longer privy to that information.

CHANGES
-------

- date-time-moment-parser package has been renamed to
  datetime-moment-parser for consistency with the rest of the codebase
- hasMeridian has been renamed to hasMeridiem in the datetime package
  and will be renamed elsewhere in a later patch
- tests that rely on datetime formatting using locale-specific formats
  must now explicitly configure the datetime package with those formats
  using the API `getI18nFormats` exported by the initializer, which the
  tests do have access to, unlike the regular codebase
- conversely, tests no longer have to stub I18n phrases using the
  I18nStubber module merely to format datetimes

TEST PLAN
---- ----

The patch has no logical changes so the test suite should suffice, but
if you insist you can verify that any datepicker widget still works OK
using a locale other than en_US.

Change-Id: I8706556e329e8d931c4673d8f24582fc60a72565
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266897
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-08-24 17:43:05 +00:00
..
formats.js extract @canvas/timezone into a package 2021-08-24 17:43:05 +00:00
index.js extract @canvas/timezone into a package 2021-08-24 17:43:05 +00:00
package.json extract @canvas/timezone into a package 2021-08-24 17:43:05 +00:00
test.js extract @canvas/timezone into a package 2021-08-24 17:43:05 +00:00