Commit b138ec3d authored by Phil Hughes's avatar Phil Hughes

Removed jQuery UI datepicker

Part of #18437 to remove jQuery UI. This removes the datepicker
parent 572fb0be
...@@ -10,7 +10,6 @@ function requireAll(context) { return context.keys().map(context); } ...@@ -10,7 +10,6 @@ function requireAll(context) { return context.keys().map(context); }
window.$ = window.jQuery = require('jquery'); window.$ = window.jQuery = require('jquery');
require('jquery-ui/ui/autocomplete'); require('jquery-ui/ui/autocomplete');
require('jquery-ui/ui/datepicker');
require('jquery-ui/ui/draggable'); require('jquery-ui/ui/draggable');
require('jquery-ui/ui/effect-highlight'); require('jquery-ui/ui/effect-highlight');
require('jquery-ui/ui/sortable'); require('jquery-ui/ui/sortable');
...@@ -35,6 +34,7 @@ require('bootstrap/js/transition'); ...@@ -35,6 +34,7 @@ require('bootstrap/js/transition');
require('bootstrap/js/tooltip'); require('bootstrap/js/tooltip');
require('bootstrap/js/popover'); require('bootstrap/js/popover');
require('select2/select2.js'); require('select2/select2.js');
require('pikaday');
window._ = require('underscore'); window._ = require('underscore');
window.Dropzone = require('dropzone'); window.Dropzone = require('dropzone');
require('mousetrap'); require('mousetrap');
......
/* global Vue */ /* global Vue */
/* global dateFormat */
Vue.filter('due-date', (value) => { Vue.filter('due-date', (value) => {
const date = new Date(value); const date = new Date(value);
return $.datepicker.formatDate('M d, yy', date); return dateFormat(date, 'mmm d, yyyy');
}); });
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */ /* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
/* global dateFormat */
(function(global) { (function(global) {
class DueDateSelect { class DueDateSelect {
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
// Construct Date object manually to avoid buggy dateString support within Date constructor // Construct Date object manually to avoid buggy dateString support within Date constructor
const dateArray = this.rawSelectedDate.split('-').map(v => parseInt(v, 10)); const dateArray = this.rawSelectedDate.split('-').map(v => parseInt(v, 10));
const dateObj = new Date(dateArray[0], dateArray[1] - 1, dateArray[2]); const dateObj = new Date(dateArray[0], dateArray[1] - 1, dateArray[2]);
this.displayedDate = $.datepicker.formatDate('M d, yy', dateObj); this.displayedDate = dateFormat(dateObj, 'mmm d, yyyy');
} else { } else {
this.displayedDate = 'No due date'; this.displayedDate = 'No due date';
} }
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
/* global UsersSelect */ /* global UsersSelect */
/* global ZenMode */ /* global ZenMode */
/* global Autosave */ /* global Autosave */
/* global dateFormat */
/* global Pikaday */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
...@@ -35,12 +37,13 @@ ...@@ -35,12 +37,13 @@
this.initMoveDropdown(); this.initMoveDropdown();
$issuableDueDate = $('#issuable-due-date'); $issuableDueDate = $('#issuable-due-date');
if ($issuableDueDate.length) { if ($issuableDueDate.length) {
$('.datepicker').datepicker({ new Pikaday({
dateFormat: 'yy-mm-dd', field: $issuableDueDate.get(0),
onSelect: function(dateText, inst) { format: 'yyyy-mm-dd',
return $issuableDueDate.val(dateText); onSelect: function(dateText) {
$issuableDueDate.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
} }
}).datepicker('setDate', $.datepicker.parseDate('yy-mm-dd', $issuableDueDate.val())); }).setDate(new Date($issuableDueDate.val()));
} }
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory * This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope. * the top of the compiled file, but it's generally better to create a new file per style scope.
*= require jquery-ui/datepicker
*= require jquery-ui/autocomplete *= require jquery-ui/autocomplete
*= require jquery.atwho *= require jquery.atwho
*= require select2 *= require select2
...@@ -19,6 +18,8 @@ ...@@ -19,6 +18,8 @@
* directory. * directory.
*/ */
@import "../../../node_modules/pikaday/scss/pikaday";
/* /*
* GitLab UI framework * GitLab UI framework
*/ */
......
...@@ -85,11 +85,16 @@ ...@@ -85,11 +85,16 @@
:javascript :javascript
var date = $('#personal_access_token_expires_at').val(); var $dateField = $('#personal_access_token_expires_at');
var date = $dateField.val();
var datepicker = $(".datepicker").datepicker({
dateFormat: "yy-mm-dd", new Pikaday({
minDate: 0 field: $dateField.get(0),
format: 'yyyy-mm-dd',
minDate: new Date(),
onSelect: function(dateText) {
$dateField.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
}
}); });
$("#created-personal-access-token").click(function() { $("#created-personal-access-token").click(function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment