Skip to content

Commit

Permalink
Update MomentJS dependency (#9382)
Browse files Browse the repository at this point in the history
* Update MomentJS dependency

Origin: #9376

* Updating momentJS fixes an issue with sorting date values

The commit fixes the tests.

* Fix dateFormat pattern

* - Correct the date format on the remaining cases in multiColumnSorting.spec.js.

* Bump moment dependency for the 'handsontable' workspace and the root directory.

* Docs: Adding docs changes related to the Moment.js dependency update (#9409)

Co-authored-by: Jan Siegel <jansiegel@users.noreply.github.com>
Co-authored-by: Jan Siegel <js.ziggle@gmail.com>
Co-authored-by: Kuba Jakub <jakub.wisniewski@handsontable.com>
  • Loading branch information
4 people committed Apr 22, 2022
1 parent 69bc87a commit 206fe29
Show file tree
Hide file tree
Showing 8 changed files with 788 additions and 1,103 deletions.
7 changes: 7 additions & 0 deletions .changelogs/9381.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Updated the Moment.js dependency from `2.24.0` to `2.29.3`, in reaction to a minor security vulnerability found recently in Moment.js.",
"type": "fixed",
"issue": 9381,
"breaking": false,
"framework": "none"
}
2 changes: 1 addition & 1 deletion docs/next/guides/building-and-testing/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ If you are a "Bob the Builder" kind of hacker, you will need to load Handsontabl
```html
<!-- Required dependencies (as external scripts) -->
<link href="https://cdn.jsdelivr.net/npm/pikaday@1.5.1/css/pikaday.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/moment@2.20.1/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.3/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pikaday@1.5.1/pikaday.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/numbro@2/dist/numbro.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hot-formula-parser@3.0.0/dist/formula-parser.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/next/guides/cell-types/date-cell-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To trigger the date cell type, use the option `type: 'date'` in the `columns` ar
Note that date cell requires additional modules :

```html
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.3/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pikaday@1.8.2/pikaday.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pikaday@1.8.2/css/pikaday.css">
```
Expand Down
2 changes: 1 addition & 1 deletion handsontable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@types/pikaday": "1.7.4",
"core-js": "^3.0.0",
"dompurify": "^2.1.1",
"moment": "2.24.0",
"moment": "2.29.3",
"numbro": "2.1.2",
"pikaday": "1.8.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ describe('ColumnSorting', () => {
{},
{
type: 'date',
dateFormat: 'mm/dd/yy'
dateFormat: 'MM/DD/YYYY'
},
{
type: 'numeric'
Expand All @@ -1018,19 +1018,19 @@ describe('ColumnSorting', () => {

getPlugin('columnSorting').sort({ column: 2, sortOrder: 'asc' }); // ASC

expect(getDataAtRow(0)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(1)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(2)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(3)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(4)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(0)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(1)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(2)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(3)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(4)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);

getPlugin('columnSorting').sort({ column: 2, sortOrder: 'desc' }); // DESC

expect(getDataAtRow(0)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(1)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(2)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(3)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(4)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(0)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(1)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(2)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(3)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(4)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe('MultiColumnSorting', () => {
{},
{
type: 'date',
dateFormat: 'mm/dd/yy'
dateFormat: 'MM/DD/YY'
},
{
type: 'numeric'
Expand Down Expand Up @@ -973,7 +973,7 @@ describe('MultiColumnSorting', () => {
{},
{
type: 'date',
dateFormat: 'mm/dd/yy'
dateFormat: 'MM/DD/YYYY'
},
{
type: 'numeric'
Expand All @@ -985,19 +985,19 @@ describe('MultiColumnSorting', () => {

getPlugin('multiColumnSorting').sort({ column: 2, sortOrder: 'asc' }); // ASC

expect(getDataAtRow(0)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(1)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(2)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(3)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(4)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(0)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(1)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(2)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(3)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(4)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);

getPlugin('multiColumnSorting').sort({ column: 2, sortOrder: 'desc' }); // DESC

expect(getDataAtRow(0)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(1)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(2)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(3)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
expect(getDataAtRow(4)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(0)).toEqual(['Audi', 'A4 Avant', '11/19/2011', 33900]);
expect(getDataAtRow(1)).toEqual(['BMW', '320i Coupe', '07/24/2011', 30500]);
expect(getDataAtRow(2)).toEqual(['Citroen', 'C4 Coupe', '12/01/2008', 8330]);
expect(getDataAtRow(3)).toEqual(['Mercedes', 'A 160', '01/14/2006', 6999.9999]);
expect(getDataAtRow(4)).toEqual(['Opel', 'Astra', '02/02/2004', 7000]);
});
});

Expand Down Expand Up @@ -1452,7 +1452,7 @@ describe('MultiColumnSorting', () => {
{},
{
type: 'date',
dateFormat: 'mm/dd/yy'
dateFormat: 'MM/DD/YY'
},
{
type: 'numeric'
Expand Down

0 comments on commit 206fe29

Please sign in to comment.