BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e4883e7e
Commit
e4883e7e
authored
Jan 02, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary utility function
parent
4d2fbe65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
17 deletions
+3
-17
due_date_select.js.es6
app/assets/javascripts/due_date_select.js.es6
+2
-3
datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+1
-14
No files found.
app/assets/javascripts/due_date_select.js.es6
View file @
e4883e7e
...
...
@@ -83,9 +83,8 @@
this.rawSelectedDate = $(`input[name='${this.fieldName}']`).val();
if (this.rawSelectedDate.length) {
// Avoid time zone inconsistency using the utils.createDateObject
// method, instead of the native Date object.
const dateObj = gl.utils.createDateObject(this.rawSelectedDate);
const dateArray = this.rawSelectedDate.split('-').map(v => parseInt(v, 10));
const dateObj = new Date(dateArray[0], dateArray[1] - 1, dateArray[2]);
this.displayedDate = $.datepicker.formatDate('M d, yy', dateObj);
} else {
this.displayedDate = 'No due date';
...
...
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
e4883e7e
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, comma-dangle, no-unused-expressions, prefer-template, p
refer-arrow-callback, p
added-blocks, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, comma-dangle, no-unused-expressions, prefer-template, padded-blocks, max-len */
/* global timeago */
/* global dateFormat */
...
...
@@ -16,19 +16,6 @@
}
w
.
gl
.
utils
.
days
=
[
'Sunday'
,
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
,
'Saturday'
];
// createDateObject must be used instead of using native Date object
// to create a new Date instance using string as param - '2016-11-10' or
// '2016/11/10' in order to avoid time zone inconsistency.
w
.
gl
.
utils
.
createDateObject
=
function
(
string
)
{
var
dateSeparator
=
string
.
indexOf
(
'-'
)
>
-
1
?
'-'
:
'/'
;
var
dateArray
=
string
.
split
(
dateSeparator
).
map
(
function
(
dateItem
)
{
return
parseInt
(
dateItem
,
10
);
});
return
new
Date
(
dateArray
[
0
],
dateArray
[
1
]
-
1
,
dateArray
[
2
]);
};
w
.
gl
.
utils
.
formatDate
=
function
(
datetime
)
{
return
dateFormat
(
datetime
,
'mmm d, yyyy h:MMtt Z'
);
};
...
...
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