Refactored format date to accept an optional useLocale paramater, included this parameter where the function is used throughout the app, and updated the unit tests to include a locale to ensure consistent results. Related to task T2139
Details
- Reviewers
bytesofman - Group Reviewers
Restricted Project - Commits
- rABC8608f16e05ee: [Cashtab] formatDate function patch
cd web/cashtab && npm start
Check that dates on wallet tab match browser's locale
Check that dates on SendToken page match browser's locale
In browser settings, switch to another language.
Check that dates on wallet tab match browser's locale
Check that dates on SendToken pafe match browser's locale.
npm test
ensure that all tests pass.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- format-date-patch
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 17888 Build 35602: Build Diff cashtab-tests Build 35601: arc lint + arc unit
Event Timeline
web/cashtab/src/utils/__tests__/formatting.test.js | ||
---|---|---|
62 ↗ | (On Diff #31704) | Should this be expected to be en format or is that because your machine is in en format? |
web/cashtab/src/utils/formatting.js | ||
3 ↗ | (On Diff #31704) | (dateString, userLocale) change to dateString, userLocale=en; that way if userLocale is not specified the function will fall back to a known default |
Responding to review feedback, hardcoded the userLocale param to equal en and removed the optional locale param from the new Date function in the unit tests.
web/cashtab/src/utils/__tests__/formatting.test.js | ||
---|---|---|
52 ↗ | (On Diff #31729) | Would the output of this expression be different for a user in France vs Canada? Make sure that locale is specified everywhere in the unit tests, that way what we are testing does not vary with region (and, in cases where the test might still have technically passed, the snapshots won't change). |