diff --git a/src/shared/util.js b/src/shared/util.js index e4884734326..b1f56132650 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -282,6 +282,8 @@ export function looseEqual (a: any, b: any): boolean { return a.length === b.length && a.every((e, i) => { return looseEqual(e, b[i]) }) + } else if (a instanceof Date && b instanceof Date) { + return a.getTime() === b.getTime() } else if (!isArrayA && !isArrayB) { const keysA = Object.keys(a) const keysB = Object.keys(b) diff --git a/test/unit/features/directives/model-select.spec.js b/test/unit/features/directives/model-select.spec.js index c961224972b..2bf5cb4d357 100644 --- a/test/unit/features/directives/model-select.spec.js +++ b/test/unit/features/directives/model-select.spec.js @@ -588,4 +588,31 @@ describe('Directive v-model select', () => { }).then(done) }) }) + + // #7928 + it('should correctly handle option with date value', done => { + const vm = new Vue({ + data: { + dates: [ + new Date(1520000000000), + new Date(1522000000000), + new Date(1516000000000) + ], + selectedDate: null + }, + template: + '