Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1b98ee75
Commit
1b98ee75
authored
Jul 18, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds datefix class.
parent
a56ca172
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
app/assets/javascripts/due_date_select.js
app/assets/javascripts/due_date_select.js
+4
-4
app/assets/javascripts/lib/utils/datefix.js
app/assets/javascripts/lib/utils/datefix.js
+9
-0
No files found.
app/assets/javascripts/due_date_select.js
View file @
1b98ee75
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
/* global dateFormat */
/* global dateFormat */
/* global Pikaday */
/* global Pikaday */
import
DateFix
from
'
./lib/utils/datefix
'
class
DueDateSelect
{
class
DueDateSelect
{
constructor
({
$dropdown
,
$loading
}
=
{})
{
constructor
({
$dropdown
,
$loading
}
=
{})
{
const
$dropdownParent
=
$dropdown
.
closest
(
'
.dropdown
'
);
const
$dropdownParent
=
$dropdown
.
closest
(
'
.dropdown
'
);
...
@@ -50,7 +52,6 @@ class DueDateSelect {
...
@@ -50,7 +52,6 @@ class DueDateSelect {
format
:
'
yyyy-mm-dd
'
,
format
:
'
yyyy-mm-dd
'
,
onSelect
:
(
dateText
)
=>
{
onSelect
:
(
dateText
)
=>
{
const
formattedDate
=
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
);
const
formattedDate
=
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
);
$dueDateInput
.
val
(
formattedDate
);
$dueDateInput
.
val
(
formattedDate
);
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
if
(
this
.
$dropdown
.
hasClass
(
'
js-issue-boards-due-date
'
))
{
...
@@ -62,7 +63,7 @@ class DueDateSelect {
...
@@ -62,7 +63,7 @@ class DueDateSelect {
}
}
});
});
calendar
.
setDate
(
new
Date
(
$dueDateInput
.
val
()));
calendar
.
setDate
(
DateFix
.
dashedFix
(
$dueDateInput
.
val
()));
this
.
$datePicker
.
append
(
calendar
.
el
);
this
.
$datePicker
.
append
(
calendar
.
el
);
this
.
$datePicker
.
data
(
'
pikaday
'
,
calendar
);
this
.
$datePicker
.
data
(
'
pikaday
'
,
calendar
);
}
}
...
@@ -168,7 +169,6 @@ class DueDateSelectors {
...
@@ -168,7 +169,6 @@ class DueDateSelectors {
initMilestoneDatePicker
()
{
initMilestoneDatePicker
()
{
$
(
'
.datepicker
'
).
each
(
function
()
{
$
(
'
.datepicker
'
).
each
(
function
()
{
const
$datePicker
=
$
(
this
);
const
$datePicker
=
$
(
this
);
const
[
y
,
m
,
d
]
=
$datePicker
.
val
().
split
(
'
-
'
);
const
calendar
=
new
Pikaday
({
const
calendar
=
new
Pikaday
({
field
:
$datePicker
.
get
(
0
),
field
:
$datePicker
.
get
(
0
),
theme
:
'
gitlab-theme animate-picker
'
,
theme
:
'
gitlab-theme animate-picker
'
,
...
@@ -179,7 +179,7 @@ class DueDateSelectors {
...
@@ -179,7 +179,7 @@ class DueDateSelectors {
}
}
});
});
calendar
.
setDate
(
new
Date
(
y
,
m
-
1
,
d
));
calendar
.
setDate
(
DateFix
.
dashedFix
(
$datePicker
.
val
()
));
$datePicker
.
data
(
'
pikaday
'
,
calendar
);
$datePicker
.
data
(
'
pikaday
'
,
calendar
);
});
});
...
...
app/assets/javascripts/lib/utils/datefix.js
0 → 100644
View file @
1b98ee75
const
DateFix
=
{
dashedFix
(
val
)
{
const
[
y
,
m
,
d
]
=
val
.
split
(
'
-
'
);
console
.
log
(
y
,
m
,
d
)
return
new
Date
(
y
,
m
-
1
,
d
);
}
}
export
default
DateFix
;
\ No newline at end of file
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