@atlaskit/datetime-picker 17.6.5 → 17.7.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/CHANGELOG.md +7 -0
- package/dist/cjs/components/date-picker.js +17 -12
- package/dist/cjs/components/date-time-picker-class.js +1 -1
- package/dist/cjs/components/date-time-picker-fc.js +472 -8
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/internal/convert-to24hr-time.js +66 -0
- package/dist/cjs/internal/format-date.js +39 -0
- package/dist/cjs/internal/{date-picker-migration.js → get-parsed-iso.js} +1 -45
- package/dist/cjs/internal/get-placeholder.js +32 -0
- package/dist/cjs/internal/get-safe-calendar-value.js +18 -0
- package/dist/cjs/internal/get-short-iso-string.js +13 -0
- package/dist/cjs/internal/is-date-disabled.js +29 -0
- package/dist/cjs/internal/is-valid.js +39 -0
- package/dist/cjs/internal/parse-date.js +31 -20
- package/dist/cjs/internal/parse-time.js +6 -102
- package/dist/cjs/internal/remove-spacer.js +9 -0
- package/dist/es2019/components/date-picker.js +8 -3
- package/dist/es2019/components/date-time-picker-class.js +1 -1
- package/dist/es2019/components/date-time-picker-fc.js +454 -5
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/internal/convert-to24hr-time.js +60 -0
- package/dist/es2019/internal/format-date.js +34 -0
- package/dist/es2019/internal/{date-picker-migration.js → get-parsed-iso.js} +2 -54
- package/dist/es2019/internal/get-placeholder.js +28 -0
- package/dist/es2019/internal/get-safe-calendar-value.js +11 -0
- package/dist/es2019/internal/get-short-iso-string.js +6 -0
- package/dist/es2019/internal/is-date-disabled.js +25 -0
- package/dist/es2019/internal/is-valid.js +33 -0
- package/dist/es2019/internal/parse-date.js +33 -18
- package/dist/es2019/internal/parse-time.js +3 -96
- package/dist/es2019/internal/remove-spacer.js +3 -0
- package/dist/esm/components/date-picker.js +8 -3
- package/dist/esm/components/date-time-picker-class.js +1 -1
- package/dist/esm/components/date-time-picker-fc.js +471 -7
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/internal/convert-to24hr-time.js +60 -0
- package/dist/esm/internal/format-date.js +32 -0
- package/dist/esm/internal/{date-picker-migration.js → get-parsed-iso.js} +2 -46
- package/dist/esm/internal/get-placeholder.js +26 -0
- package/dist/esm/internal/get-safe-calendar-value.js +11 -0
- package/dist/esm/internal/get-short-iso-string.js +6 -0
- package/dist/esm/internal/is-date-disabled.js +23 -0
- package/dist/esm/internal/is-valid.js +33 -0
- package/dist/esm/internal/parse-date.js +31 -18
- package/dist/esm/internal/parse-time.js +3 -96
- package/dist/esm/internal/remove-spacer.js +3 -0
- package/dist/types/components/date-time-picker-fc.d.ts +6 -2
- package/dist/types/internal/convert-to24hr-time.d.ts +7 -0
- package/dist/types/internal/{date-picker-migration.d.ts → format-date.d.ts} +0 -28
- package/dist/types/internal/get-parsed-iso.d.ts +20 -0
- package/dist/types/internal/get-placeholder.d.ts +22 -0
- package/dist/types/internal/get-safe-calendar-value.d.ts +1 -0
- package/dist/types/internal/get-short-iso-string.d.ts +1 -0
- package/dist/types/internal/is-date-disabled.d.ts +20 -0
- package/dist/types/internal/is-valid.d.ts +1 -0
- package/dist/types/internal/parse-date.d.ts +26 -5
- package/dist/types/internal/parse-time.d.ts +0 -9
- package/dist/types/internal/remove-spacer.d.ts +1 -0
- package/dist/types-ts4.5/components/date-time-picker-fc.d.ts +6 -2
- package/dist/types-ts4.5/internal/convert-to24hr-time.d.ts +7 -0
- package/dist/types-ts4.5/internal/{date-picker-migration.d.ts → format-date.d.ts} +0 -28
- package/dist/types-ts4.5/internal/get-parsed-iso.d.ts +20 -0
- package/dist/types-ts4.5/internal/get-placeholder.d.ts +22 -0
- package/dist/types-ts4.5/internal/get-safe-calendar-value.d.ts +1 -0
- package/dist/types-ts4.5/internal/get-short-iso-string.d.ts +1 -0
- package/dist/types-ts4.5/internal/is-date-disabled.d.ts +20 -0
- package/dist/types-ts4.5/internal/is-valid.d.ts +1 -0
- package/dist/types-ts4.5/internal/parse-date.d.ts +26 -5
- package/dist/types-ts4.5/internal/parse-time.d.ts +0 -9
- package/dist/types-ts4.5/internal/remove-spacer.d.ts +1 -0
- package/package.json +8 -11
- package/dist/cjs/components/date-time-picker-fc-new.js +0 -479
- package/dist/cjs/components/date-time-picker-fc-old.js +0 -370
- package/dist/es2019/components/date-time-picker-fc-new.js +0 -456
- package/dist/es2019/components/date-time-picker-fc-old.compiled.css +0 -6
- package/dist/es2019/components/date-time-picker-fc-old.js +0 -336
- package/dist/esm/components/date-time-picker-fc-new.compiled.css +0 -6
- package/dist/esm/components/date-time-picker-fc-new.js +0 -473
- package/dist/esm/components/date-time-picker-fc-old.compiled.css +0 -6
- package/dist/esm/components/date-time-picker-fc-old.js +0 -364
- package/dist/types/components/date-time-picker-fc-new.d.ts +0 -6
- package/dist/types/components/date-time-picker-fc-old.d.ts +0 -6
- package/dist/types-ts4.5/components/date-time-picker-fc-new.d.ts +0 -6
- package/dist/types-ts4.5/components/date-time-picker-fc-old.d.ts +0 -6
- /package/dist/cjs/components/{date-time-picker-fc-new.compiled.css → date-time-picker-fc.compiled.css} +0 -0
- /package/dist/{cjs/components/date-time-picker-fc-old.compiled.css → es2019/components/date-time-picker-fc.compiled.css} +0 -0
- /package/dist/{es2019/components/date-time-picker-fc-new.compiled.css → esm/components/date-time-picker-fc.compiled.css} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
2
|
+
import { getShortISOString } from './get-short-iso-string';
|
|
3
|
+
export function getSafeCalendarValue(calendarValue) {
|
|
4
|
+
// If `calendarValue` has a year that is greater than 9999, default to
|
|
5
|
+
// today's date
|
|
6
|
+
var yearIsOverLimit = calendarValue.match(/^\d{5,}/);
|
|
7
|
+
if (yearIsOverLimit) {
|
|
8
|
+
return getShortISOString(new Date());
|
|
9
|
+
}
|
|
10
|
+
return calendarValue;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
20
|
+
export var isDateDisabled = function isDateDisabled(date, di) {
|
|
21
|
+
var disabled = di.disabled;
|
|
22
|
+
return disabled.indexOf(date) > -1;
|
|
23
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function isValid(timeString) {
|
|
2
|
+
/**
|
|
3
|
+
* Regex match for `12:34`, `12:34:56`, `1:23:56 p`, `1:23:56PM`, and a bit more…
|
|
4
|
+
*/
|
|
5
|
+
var time = timeString.trim().match(/([012]?[\d])(?::([0-5][\d]))?(?::([0-5][\d]))?\s*([ap]m?)?/i);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Regex match for `1234`, `12:34`, `12.34`, `123456`, `12:34:56`, `12.34.56`
|
|
9
|
+
*/
|
|
10
|
+
var time24hr = timeString.trim().match(/([012][\d])[:.]?([0-5][\d])([:.]?([0-5][\d]))?/);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Convert `2:34:56 pm` down to `23456`
|
|
14
|
+
*/
|
|
15
|
+
var num = timeString.replace(/[^0-9]/g, '');
|
|
16
|
+
var includesSeconds = time && time[1] !== undefined && time[2] !== undefined && time[3] !== undefined || time24hr && time24hr[1] !== undefined && time24hr[2] !== undefined && time24hr[4] !== undefined;
|
|
17
|
+
if (!time && !time24hr) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (time && !time[1]) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (num.length > 6) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (num.length > 4 && !includesSeconds) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (num.length === 2 && parseInt(num, 10) > 12) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
|
-
import { convertTokens } from './parse-tokens';
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
7
14
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { defaultDateFormat } from './index';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* There are two props that can change how the date is parsed.
|
|
23
|
+
* The priority of props used is:
|
|
24
|
+
* 1. `parseInputValue`
|
|
25
|
+
* 2. `locale`
|
|
10
26
|
*/
|
|
11
|
-
export function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var yearIsOverLimit = calendarValue.match(/^\d{5,}/);
|
|
18
|
-
if (yearIsOverLimit) {
|
|
19
|
-
return getShortISOString(new Date());
|
|
27
|
+
export var parseDate = function parseDate(date, di) {
|
|
28
|
+
var parseInputValue = di.parseInputValue,
|
|
29
|
+
dateFormat = di.dateFormat,
|
|
30
|
+
l10n = di.l10n;
|
|
31
|
+
if (parseInputValue) {
|
|
32
|
+
return parseInputValue(date, dateFormat || defaultDateFormat);
|
|
20
33
|
}
|
|
21
|
-
return
|
|
22
|
-
}
|
|
34
|
+
return l10n.parseDate(date);
|
|
35
|
+
};
|
|
@@ -1,99 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'02': '14',
|
|
5
|
-
'03': '15',
|
|
6
|
-
'04': '16',
|
|
7
|
-
'05': '17',
|
|
8
|
-
'06': '18',
|
|
9
|
-
'07': '19',
|
|
10
|
-
'08': '20',
|
|
11
|
-
'09': '21',
|
|
12
|
-
'10': '22',
|
|
13
|
-
'11': '23'
|
|
14
|
-
};
|
|
15
|
-
export function isValid(timeString) {
|
|
16
|
-
/**
|
|
17
|
-
* Regex match for `12:34`, `12:34:56`, `1:23:56 p`, `1:23:56PM`, and a bit more…
|
|
18
|
-
*/
|
|
19
|
-
var time = timeString.trim().match(/([012]?[\d])(?::([0-5][\d]))?(?::([0-5][\d]))?\s*([ap]m?)?/i);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Regex match for `1234`, `12:34`, `12.34`, `123456`, `12:34:56`, `12.34.56`
|
|
23
|
-
*/
|
|
24
|
-
var time24hr = timeString.trim().match(/([012][\d])[:.]?([0-5][\d])([:.]?([0-5][\d]))?/);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Convert `2:34:56 pm` down to `23456`
|
|
28
|
-
*/
|
|
29
|
-
var num = timeString.replace(/[^0-9]/g, '');
|
|
30
|
-
var includesSeconds = time && time[1] !== undefined && time[2] !== undefined && time[3] !== undefined || time24hr && time24hr[1] !== undefined && time24hr[2] !== undefined && time24hr[4] !== undefined;
|
|
31
|
-
if (!time && !time24hr) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
if (time && !time[1]) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (num.length > 6) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
if (num.length > 4 && !includesSeconds) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
if (num.length === 2 && parseInt(num, 10) > 12) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
export function removeSpacer(time) {
|
|
49
|
-
return time.replace(/[:.]/g, '');
|
|
50
|
-
}
|
|
51
|
-
function formatSemi24(time) {
|
|
52
|
-
if (time.length === 1) {
|
|
53
|
-
return "0".concat(time, "00");
|
|
54
|
-
}
|
|
55
|
-
if (time.length === 2) {
|
|
56
|
-
return "".concat(time, "00");
|
|
57
|
-
}
|
|
58
|
-
if (time.length === 3 || time.length === 5) {
|
|
59
|
-
return "0".concat(time);
|
|
60
|
-
}
|
|
61
|
-
return time;
|
|
62
|
-
}
|
|
63
|
-
function checkHour(hour, meridiem) {
|
|
64
|
-
if (hour > '24') {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
if (hour === '12' && meridiem === 'a') {
|
|
68
|
-
return '00';
|
|
69
|
-
}
|
|
70
|
-
if (hour < '12' && meridiem === 'p') {
|
|
71
|
-
return map24[hour];
|
|
72
|
-
}
|
|
73
|
-
return hour;
|
|
74
|
-
}
|
|
75
|
-
function checkMinuteSecond(value) {
|
|
76
|
-
if (value > '59') {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
return value;
|
|
80
|
-
}
|
|
81
|
-
export function convertTo24hrTime(time) {
|
|
82
|
-
var timeArray = time.toLowerCase().split(/(p|a)/i);
|
|
83
|
-
var meridiem = timeArray[1];
|
|
84
|
-
var semi24 = formatSemi24(timeArray[0].trim());
|
|
85
|
-
var hour = checkHour(semi24.substring(0, 2), meridiem);
|
|
86
|
-
var minute = checkMinuteSecond(semi24.substring(2, 4));
|
|
87
|
-
var seconds = semi24.length === 6 && checkMinuteSecond(semi24.substring(4, 6));
|
|
88
|
-
if (!hour || !minute) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
hour: parseInt(hour, 10),
|
|
93
|
-
minute: parseInt(minute, 10),
|
|
94
|
-
seconds: parseInt(seconds || '0', 10) || 0
|
|
95
|
-
};
|
|
96
|
-
}
|
|
1
|
+
import { convertTo24hrTime } from './convert-to24hr-time';
|
|
2
|
+
import { isValid } from './is-valid';
|
|
3
|
+
import { removeSpacer } from './remove-spacer';
|
|
97
4
|
function assignToDate(time) {
|
|
98
5
|
var dateTime = new Date();
|
|
99
6
|
dateTime.setHours(time.hour);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DateTimePickerBaseProps } from '../types';
|
|
3
|
+
export declare const datePickerDefaultAriaLabel = "Date";
|
|
4
|
+
export declare const timePickerDefaultAriaLabel = "Time";
|
|
1
5
|
/**
|
|
2
6
|
* __Date time picker__
|
|
3
7
|
*
|
|
@@ -7,5 +11,5 @@
|
|
|
7
11
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
8
12
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
9
13
|
*/
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
14
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<React.PropsWithoutRef<DateTimePickerBaseProps> & React.RefAttributes<HTMLElement>>;
|
|
15
|
+
export default DateTimePicker;
|
|
@@ -16,36 +16,8 @@
|
|
|
16
16
|
* broken out to be it's own function.
|
|
17
17
|
*/
|
|
18
18
|
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
-
export declare const isDateDisabled: (date: string, di: {
|
|
20
|
-
disabled: string[];
|
|
21
|
-
}) => boolean;
|
|
22
|
-
export declare const getParsedISO: (di: {
|
|
23
|
-
iso: string;
|
|
24
|
-
}) => string;
|
|
25
|
-
/**
|
|
26
|
-
* There are two props that can change how the date is parsed.
|
|
27
|
-
* The priority of props used is:
|
|
28
|
-
* 1. `parseInputValue`
|
|
29
|
-
* 2. `locale`
|
|
30
|
-
*/
|
|
31
|
-
export declare const parseDate: (date: string, di: {
|
|
32
|
-
parseInputValue: ((date: string, dateFormat: string) => Date) | undefined;
|
|
33
|
-
dateFormat: string | undefined;
|
|
34
|
-
l10n: LocalizationProvider;
|
|
35
|
-
}) => Date;
|
|
36
|
-
/**
|
|
37
|
-
* There are multiple props that can change how the date is formatted.
|
|
38
|
-
* The priority of props used is:
|
|
39
|
-
* 1. `formatDisplayLabel`
|
|
40
|
-
* 2. `dateFormat`
|
|
41
|
-
* 3. `locale`
|
|
42
|
-
*/
|
|
43
19
|
export declare const formatDate: (value: string, di: {
|
|
44
20
|
formatDisplayLabel: ((value: string, dateFormat: string) => string) | undefined;
|
|
45
21
|
dateFormat: string | undefined;
|
|
46
22
|
l10n: LocalizationProvider;
|
|
47
23
|
}) => string;
|
|
48
|
-
export declare const getPlaceholder: (di: {
|
|
49
|
-
placeholder: string | undefined;
|
|
50
|
-
l10n: LocalizationProvider;
|
|
51
|
-
}) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getParsedISO: (di: {
|
|
19
|
+
iso: string;
|
|
20
|
+
}) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
+
export declare const getPlaceholder: (di: {
|
|
20
|
+
placeholder: string | undefined;
|
|
21
|
+
l10n: LocalizationProvider;
|
|
22
|
+
}) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSafeCalendarValue(calendarValue: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getShortISOString(date: Date): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isDateDisabled: (date: string, di: {
|
|
19
|
+
disabled: string[];
|
|
20
|
+
}) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isValid(timeString: string): boolean;
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
3
8
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
+
/**
|
|
20
|
+
* There are two props that can change how the date is parsed.
|
|
21
|
+
* The priority of props used is:
|
|
22
|
+
* 1. `parseInputValue`
|
|
23
|
+
* 2. `locale`
|
|
6
24
|
*/
|
|
7
|
-
export declare
|
|
8
|
-
|
|
25
|
+
export declare const parseDate: (date: string, di: {
|
|
26
|
+
parseInputValue: ((date: string, dateFormat: string) => Date) | undefined;
|
|
27
|
+
dateFormat: string | undefined;
|
|
28
|
+
l10n: LocalizationProvider;
|
|
29
|
+
}) => Date;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
type TimeObject = {
|
|
2
|
-
hour: number;
|
|
3
|
-
minute: number;
|
|
4
|
-
seconds: number;
|
|
5
|
-
};
|
|
6
|
-
export declare function isValid(timeString: string): boolean;
|
|
7
|
-
export declare function removeSpacer(time: string): string;
|
|
8
|
-
export declare function convertTo24hrTime(time: string): TimeObject | null;
|
|
9
1
|
export default function parseTime(time: string): string | Date;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function removeSpacer(time: string): string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DateTimePickerBaseProps } from '../types';
|
|
3
|
+
export declare const datePickerDefaultAriaLabel = "Date";
|
|
4
|
+
export declare const timePickerDefaultAriaLabel = "Time";
|
|
1
5
|
/**
|
|
2
6
|
* __Date time picker__
|
|
3
7
|
*
|
|
@@ -7,5 +11,5 @@
|
|
|
7
11
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
8
12
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
9
13
|
*/
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
14
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<React.PropsWithoutRef<DateTimePickerBaseProps> & React.RefAttributes<HTMLElement>>;
|
|
15
|
+
export default DateTimePicker;
|
|
@@ -16,36 +16,8 @@
|
|
|
16
16
|
* broken out to be it's own function.
|
|
17
17
|
*/
|
|
18
18
|
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
-
export declare const isDateDisabled: (date: string, di: {
|
|
20
|
-
disabled: string[];
|
|
21
|
-
}) => boolean;
|
|
22
|
-
export declare const getParsedISO: (di: {
|
|
23
|
-
iso: string;
|
|
24
|
-
}) => string;
|
|
25
|
-
/**
|
|
26
|
-
* There are two props that can change how the date is parsed.
|
|
27
|
-
* The priority of props used is:
|
|
28
|
-
* 1. `parseInputValue`
|
|
29
|
-
* 2. `locale`
|
|
30
|
-
*/
|
|
31
|
-
export declare const parseDate: (date: string, di: {
|
|
32
|
-
parseInputValue: ((date: string, dateFormat: string) => Date) | undefined;
|
|
33
|
-
dateFormat: string | undefined;
|
|
34
|
-
l10n: LocalizationProvider;
|
|
35
|
-
}) => Date;
|
|
36
|
-
/**
|
|
37
|
-
* There are multiple props that can change how the date is formatted.
|
|
38
|
-
* The priority of props used is:
|
|
39
|
-
* 1. `formatDisplayLabel`
|
|
40
|
-
* 2. `dateFormat`
|
|
41
|
-
* 3. `locale`
|
|
42
|
-
*/
|
|
43
19
|
export declare const formatDate: (value: string, di: {
|
|
44
20
|
formatDisplayLabel: ((value: string, dateFormat: string) => string) | undefined;
|
|
45
21
|
dateFormat: string | undefined;
|
|
46
22
|
l10n: LocalizationProvider;
|
|
47
23
|
}) => string;
|
|
48
|
-
export declare const getPlaceholder: (di: {
|
|
49
|
-
placeholder: string | undefined;
|
|
50
|
-
l10n: LocalizationProvider;
|
|
51
|
-
}) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getParsedISO: (di: {
|
|
19
|
+
iso: string;
|
|
20
|
+
}) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
+
export declare const getPlaceholder: (di: {
|
|
20
|
+
placeholder: string | undefined;
|
|
21
|
+
l10n: LocalizationProvider;
|
|
22
|
+
}) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSafeCalendarValue(calendarValue: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getShortISOString(date: Date): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
8
|
+
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isDateDisabled: (date: string, di: {
|
|
19
|
+
disabled: string[];
|
|
20
|
+
}) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isValid(timeString: string): boolean;
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
+
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
+
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
+
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
+
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
+
* so, thank you!
|
|
3
8
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
9
|
+
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
+
* be read from within the component at the end of the day. But because we are
|
|
11
|
+
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
+
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
+
* and instead use internal variables.
|
|
14
|
+
*
|
|
15
|
+
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
+
* broken out to be it's own function.
|
|
17
|
+
*/
|
|
18
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
+
/**
|
|
20
|
+
* There are two props that can change how the date is parsed.
|
|
21
|
+
* The priority of props used is:
|
|
22
|
+
* 1. `parseInputValue`
|
|
23
|
+
* 2. `locale`
|
|
6
24
|
*/
|
|
7
|
-
export declare
|
|
8
|
-
|
|
25
|
+
export declare const parseDate: (date: string, di: {
|
|
26
|
+
parseInputValue: ((date: string, dateFormat: string) => Date) | undefined;
|
|
27
|
+
dateFormat: string | undefined;
|
|
28
|
+
l10n: LocalizationProvider;
|
|
29
|
+
}) => Date;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
type TimeObject = {
|
|
2
|
-
hour: number;
|
|
3
|
-
minute: number;
|
|
4
|
-
seconds: number;
|
|
5
|
-
};
|
|
6
|
-
export declare function isValid(timeString: string): boolean;
|
|
7
|
-
export declare function removeSpacer(time: string): string;
|
|
8
|
-
export declare function convertTo24hrTime(time: string): TimeObject | null;
|
|
9
1
|
export default function parseTime(time: string): string | Date;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function removeSpacer(time: string): string;
|