Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
e40c17f6
Commit
e40c17f6
authored
Jan 28, 2018
by
Hi-Linlin
Committed by
杨奕
Jan 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DatePicker: panels should display different months (#9471)
parent
3d7d4980
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
packages/date-picker/src/panel/date-range.vue
packages/date-picker/src/panel/date-range.vue
+11
-3
test/unit/specs/date-picker.spec.js
test/unit/specs/date-picker.spec.js
+26
-0
No files found.
packages/date-picker/src/panel/date-range.vue
View file @
e40c17f6
...
...
@@ -395,9 +395,17 @@
// should allow them to be set individually in the future
if
(
this
.
minDate
)
{
this
.
leftDate
=
this
.
minDate
;
this
.
rightDate
=
this
.
unlinkPanels
&&
this
.
maxDate
?
this
.
maxDate
:
nextMonth
(
this
.
leftDate
);
if
(
this
.
unlinkPanels
&&
this
.
maxDate
)
{
const
minDateYear
=
this
.
minDate
.
getFullYear
();
const
minDateMonth
=
this
.
minDate
.
getMonth
();
const
maxDateYear
=
this
.
maxDate
.
getFullYear
();
const
maxDateMonth
=
this
.
maxDate
.
getMonth
();
this
.
rightDate
=
minDateYear
===
maxDateYear
&&
minDateMonth
===
maxDateMonth
?
nextMonth
(
this
.
maxDate
)
:
this
.
maxDate
;
}
else
{
this
.
rightDate
=
nextMonth
(
this
.
leftDate
);
}
}
else
{
this
.
leftDate
=
calcDefaultValue
(
this
.
defaultValue
)[
0
];
this
.
rightDate
=
nextMonth
(
this
.
leftDate
);
...
...
test/unit/specs/date-picker.spec.js
View file @
e40c17f6
...
...
@@ -1144,6 +1144,32 @@ describe('DatePicker', () => {
},
DELAY
);
});
it
(
'
type:daterange unlink:true
'
,
done
=>
{
vm
=
createVue
({
template
:
'
<el-date-picker type="daterange" unlink-panels v-model="value" ref="compo" />
'
,
data
()
{
return
{
value
:
[
new
Date
(
2000
,
9
,
1
),
new
Date
(
2000
,
9
,
2
)]
};
}
},
true
);
const
rangePicker
=
vm
.
$refs
.
compo
;
const
inputs
=
rangePicker
.
$el
.
querySelectorAll
(
'
input
'
);
setTimeout
(
_
=>
{
inputs
[
0
].
focus
();
setTimeout
(
_
=>
{
const
panels
=
rangePicker
.
picker
.
$el
.
querySelectorAll
(
'
.el-date-range-picker__content
'
);
const
left
=
panels
[
0
].
querySelector
(
'
.el-date-range-picker__header
'
);
const
right
=
panels
[
1
].
querySelector
(
'
.is-right .el-date-range-picker__header
'
);
const
leftText
=
left
.
textContent
.
match
(
/
\d
+/g
).
map
(
i
=>
Number
(
i
));
const
rightText
=
right
.
textContent
.
match
(
/
\d
+/g
).
map
(
i
=>
Number
(
i
));
expect
(
rightText
[
1
]
-
leftText
[
1
]).
to
.
equal
(
1
);
// one month
done
();
},
DELAY
);
},
DELAY
);
});
it
(
'
unlink panels
'
,
done
=>
{
vm
=
createTest
(
DatePicker
,
{
type
:
'
daterange
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment