datatables.net-datetime 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/dataTables.dateTime.scss +123 -15
- package/datatables.net-datetime.1.4.0.nupkg +0 -0
- package/dist/dataTables.dateTime.css +92 -18
- package/dist/dataTables.dateTime.js +37 -8
- package/dist/dataTables.dateTime.min.css +1 -1
- package/dist/dataTables.dateTime.min.js +2 -2
- package/dist/dataTables.dateTime.min.mjs +2 -2
- package/dist/dataTables.dateTime.mjs +37 -8
- package/docs/api/display().xml +29 -0
- package/examples/index.xml +1 -0
- package/examples/initialisation/buttons.xml +18 -7
- package/examples/initialisation/datetime.xml +12 -4
- package/examples/initialisation/dayjs.xml +16 -4
- package/examples/initialisation/hidden.xml +10 -4
- package/examples/initialisation/i18n.xml +48 -9
- package/examples/initialisation/index.xml +1 -0
- package/examples/initialisation/luxon.xml +13 -4
- package/examples/initialisation/moment.xml +12 -4
- package/examples/initialisation/simple.xml +10 -4
- package/examples/integration/datatables.xml +69 -34
- package/examples/integration/form.xml +38 -19
- package/js/dataTables.dateTime.js +37 -8
- package/nuget.nuspec +1 -1
- package/package.json +1 -1
- package/test/api/dateTime.destroy().js +4 -4
- package/test/api/dateTime.hide().js +5 -5
- package/test/options/dateTime.firstDay.js +2 -2
- package/test/options/dateTime.init.js +4 -4
- package/examples/initialisation/jquery.xml +0 -28
|
@@ -5,31 +5,50 @@
|
|
|
5
5
|
|
|
6
6
|
<js lib="jquery moment datetime">
|
|
7
7
|
<![CDATA[
|
|
8
|
+
new DateTime('#inputDate', {
|
|
9
|
+
format: 'MMMM Do YYYY'
|
|
10
|
+
});
|
|
11
|
+
new DateTime('#inputTime', {
|
|
12
|
+
format: 'h:mm a'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
$('#appointment').on('submit', function (e) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
|
|
18
|
+
var name = $('#inputName').val();
|
|
19
|
+
var phone = $('#inputPhone').val();
|
|
20
|
+
var date = $('#inputDate').val();
|
|
21
|
+
var time = $('#inputTime').val();
|
|
8
22
|
|
|
9
|
-
|
|
10
|
-
new DateTime($('#inputDate'), {
|
|
11
|
-
format: 'MMMM Do YYYY'
|
|
12
|
-
});
|
|
13
|
-
new DateTime($('#inputTime'), {
|
|
14
|
-
format: 'h:mm a'
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
$('#appointment').on('submit', function (e) {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
|
|
20
|
-
alert(
|
|
21
|
-
'Making an appointment for ' +
|
|
22
|
-
$('#inputName').val() +
|
|
23
|
-
' (' + $('#inputPhone').val() + ') on ' +
|
|
24
|
-
$('#inputDate').val() + ' at ' +
|
|
25
|
-
$('#inputTime').val()
|
|
26
|
-
);
|
|
27
|
-
});
|
|
23
|
+
alert('Making an appointment for ' + name + ' (' + phone + ') on ' + date + ' at ' + time);
|
|
28
24
|
});
|
|
29
25
|
|
|
30
26
|
]]>
|
|
31
27
|
</js>
|
|
32
28
|
|
|
29
|
+
<js-vanilla>
|
|
30
|
+
<![CDATA[
|
|
31
|
+
new DateTime('#inputDate', {
|
|
32
|
+
format: 'MMMM Do YYYY'
|
|
33
|
+
});
|
|
34
|
+
new DateTime('#inputTime', {
|
|
35
|
+
format: 'h:mm a'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
document.querySelector('#appointment').addEventListener('submit', function (e) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
|
|
41
|
+
let name = document.querySelector('#inputName').value;
|
|
42
|
+
let phone = document.querySelector('#inputPhone').value;
|
|
43
|
+
let date = document.querySelector('#inputDate').value;
|
|
44
|
+
let time = document.querySelector('#inputTime').value;
|
|
45
|
+
|
|
46
|
+
alert('Making an appointment for ' + name + ' (' + phone + ') on ' + date + ' at ' + time);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
]]>
|
|
50
|
+
</js-vanilla>
|
|
51
|
+
|
|
33
52
|
<title lib="DateTime">Use in a form</title>
|
|
34
53
|
|
|
35
54
|
<info><![CDATA[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DateTime picker for DataTables.net v1.
|
|
1
|
+
/*! DateTime picker for DataTables.net v1.5.0
|
|
2
2
|
*
|
|
3
3
|
* © SpryMedia Ltd, all rights reserved.
|
|
4
4
|
* License: MIT datatables.net/license/mit
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @summary DateTime picker for DataTables.net
|
|
9
|
-
* @version 1.
|
|
9
|
+
* @version 1.5.0
|
|
10
10
|
* @file dataTables.dateTime.js
|
|
11
11
|
* @author SpryMedia Ltd
|
|
12
12
|
* @contact www.datatables.net/contact
|
|
@@ -155,6 +155,8 @@ var DateTime = function ( input, opts ) {
|
|
|
155
155
|
.append( this.dom.buttons )
|
|
156
156
|
.append( this.dom.calendar );
|
|
157
157
|
|
|
158
|
+
this.dom.input.addClass('dt-datetime');
|
|
159
|
+
|
|
158
160
|
this._constructor();
|
|
159
161
|
};
|
|
160
162
|
|
|
@@ -170,10 +172,33 @@ $.extend( DateTime.prototype, {
|
|
|
170
172
|
this._hide(true);
|
|
171
173
|
this.dom.container.off().empty();
|
|
172
174
|
this.dom.input
|
|
175
|
+
.removeClass('dt-datetime')
|
|
173
176
|
.removeAttr('autocomplete')
|
|
174
177
|
.off('.datetime');
|
|
175
178
|
},
|
|
176
179
|
|
|
180
|
+
display: function (year, month) {
|
|
181
|
+
if (year !== undefined) {
|
|
182
|
+
this.s.display.setUTCFullYear(year);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (month !== undefined) {
|
|
186
|
+
this.s.display.setUTCMonth(month - 1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (year !== undefined || month !== undefined) {
|
|
190
|
+
this._setTitle();
|
|
191
|
+
this._setCalander();
|
|
192
|
+
|
|
193
|
+
return this;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
month: this.s.display.getUTCMonth() + 1,
|
|
198
|
+
year: this.s.display.getUTCFullYear()
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
|
|
177
202
|
errorMsg: function ( msg ) {
|
|
178
203
|
var error = this.dom.error;
|
|
179
204
|
|
|
@@ -1509,21 +1534,25 @@ $.extend( DateTime.prototype, {
|
|
|
1509
1534
|
_writeOutput: function ( focus ) {
|
|
1510
1535
|
var date = this.s.d;
|
|
1511
1536
|
var out = '';
|
|
1537
|
+
var input = this.dom.input;
|
|
1512
1538
|
|
|
1513
1539
|
if (date) {
|
|
1514
1540
|
out = this._convert(date, null, this.c.format);
|
|
1515
1541
|
}
|
|
1516
1542
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1543
|
+
input.val( out );
|
|
1544
|
+
|
|
1545
|
+
// Create a DOM synthetic event. Can't use $().trigger() as
|
|
1546
|
+
// that doesn't actually trigger non-jQuery event listeners
|
|
1547
|
+
var event = new Event('change', {bubbles: true});
|
|
1548
|
+
input[0].dispatchEvent(event);
|
|
1520
1549
|
|
|
1521
|
-
if (
|
|
1550
|
+
if ( input.attr('type') === 'hidden' ) {
|
|
1522
1551
|
this.val(out, false);
|
|
1523
1552
|
}
|
|
1524
1553
|
|
|
1525
1554
|
if ( focus ) {
|
|
1526
|
-
|
|
1555
|
+
input.focus();
|
|
1527
1556
|
}
|
|
1528
1557
|
}
|
|
1529
1558
|
} );
|
|
@@ -1613,7 +1642,7 @@ DateTime.defaults = {
|
|
|
1613
1642
|
yearRange: 25
|
|
1614
1643
|
};
|
|
1615
1644
|
|
|
1616
|
-
DateTime.version = '1.
|
|
1645
|
+
DateTime.version = '1.5.0';
|
|
1617
1646
|
|
|
1618
1647
|
/**
|
|
1619
1648
|
* CommonJS factory function pass through. Matches DataTables.
|
package/nuget.nuspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
3
3
|
<metadata>
|
|
4
4
|
<id>datatables.net-datetime</id>
|
|
5
|
-
<version>1.
|
|
5
|
+
<version>1.5.0</version>
|
|
6
6
|
<description>DataTables date / time picker</description>
|
|
7
7
|
<authors>SpryMedia Ltd</authors>
|
|
8
8
|
<projectUrl>http://datatables.net</projectUrl>
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ describe('dateTime - api - destroy()', function () {
|
|
|
27
27
|
});
|
|
28
28
|
it('... date picker cant be opened', function () {
|
|
29
29
|
$('#test').click();
|
|
30
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
30
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
dt.html('input');
|
|
@@ -35,15 +35,15 @@ describe('dateTime - api - destroy()', function () {
|
|
|
35
35
|
el = new DateTime(document.getElementById('test'), {});
|
|
36
36
|
$('#test').click();
|
|
37
37
|
|
|
38
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
38
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
39
39
|
|
|
40
40
|
el.destroy();
|
|
41
41
|
|
|
42
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
42
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
43
43
|
});
|
|
44
44
|
it('... date picker cant be opened', function () {
|
|
45
45
|
$('#test').click();
|
|
46
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
46
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -23,11 +23,11 @@ describe('dateTime - api - hide()', function () {
|
|
|
23
23
|
el = new DateTime(document.getElementById('test'), {});
|
|
24
24
|
el.hide();
|
|
25
25
|
|
|
26
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
26
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
27
27
|
});
|
|
28
28
|
it('... date picker can be opened', function () {
|
|
29
29
|
$('#test').click();
|
|
30
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
30
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
dt.html('input');
|
|
@@ -35,15 +35,15 @@ describe('dateTime - api - hide()', function () {
|
|
|
35
35
|
el = new DateTime(document.getElementById('test'), {});
|
|
36
36
|
$('#test').click();
|
|
37
37
|
|
|
38
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
38
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
39
39
|
|
|
40
40
|
el.hide();
|
|
41
41
|
|
|
42
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
42
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
43
43
|
});
|
|
44
44
|
it('... date picker can be opened', function () {
|
|
45
45
|
$('#test').click();
|
|
46
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
46
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -16,7 +16,7 @@ describe('dateTime - options - firstDay', function () {
|
|
|
16
16
|
it('Mid-week', function () {
|
|
17
17
|
new DateTime(document.getElementById('test'), {firstDay: 3});
|
|
18
18
|
|
|
19
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
19
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
20
20
|
$('#test').click();
|
|
21
21
|
expect($('.dt-datetime-date thead th').text()).toBe('WedThuFriSatSunMonTue');
|
|
22
22
|
});
|
|
@@ -25,7 +25,7 @@ describe('dateTime - options - firstDay', function () {
|
|
|
25
25
|
it('end of week', function () {
|
|
26
26
|
new DateTime(document.getElementById('test'), {firstDay: 6});
|
|
27
27
|
|
|
28
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
28
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
29
29
|
$('#test').click();
|
|
30
30
|
expect($('.dt-datetime-date thead th').text()).toBe('SatSunMonTueWedThuFri');
|
|
31
31
|
});
|
|
@@ -9,9 +9,9 @@ describe('dateTime - basic initialisation', function () {
|
|
|
9
9
|
it('Standard initialsiation', function () {
|
|
10
10
|
new DateTime(document.getElementById('test'), {});
|
|
11
11
|
|
|
12
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
12
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
13
13
|
$('#test').click();
|
|
14
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
14
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
dt.html('input');
|
|
@@ -38,9 +38,9 @@ describe('dateTime - basic initialisation', function () {
|
|
|
38
38
|
dt.html('input');
|
|
39
39
|
it('jQuery initialsiation', function () {
|
|
40
40
|
$('#test').dtDateTime();
|
|
41
|
-
expect($('.dt-datetime').length).toBe(0);
|
|
41
|
+
expect($('div.dt-datetime').length).toBe(0);
|
|
42
42
|
$('#test').click();
|
|
43
|
-
expect($('.dt-datetime').length).toBe(1);
|
|
43
|
+
expect($('div.dt-datetime').length).toBe(1);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
dt.html('input');
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<dt-example table-type="html" table-class="display nowrap" order="2">
|
|
3
|
-
|
|
4
|
-
<css lib="datetime"/>
|
|
5
|
-
|
|
6
|
-
<js lib="jquery datetime">
|
|
7
|
-
<![CDATA[
|
|
8
|
-
|
|
9
|
-
$(document).ready(function() {
|
|
10
|
-
$('#test').dtDateTime();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
]]>
|
|
14
|
-
</js>
|
|
15
|
-
|
|
16
|
-
<title lib="DateTime">jQuery initialisation</title>
|
|
17
|
-
|
|
18
|
-
<info><![CDATA[
|
|
19
|
-
|
|
20
|
-
This example shows the date / time input initialised via jQuery.
|
|
21
|
-
|
|
22
|
-
]]></info>
|
|
23
|
-
|
|
24
|
-
<custom-table>
|
|
25
|
-
<input id="test" type="text" value="2020-01-17" />
|
|
26
|
-
</custom-table>
|
|
27
|
-
|
|
28
|
-
</dt-example>
|