@atlaskit/editor-plugin-date 5.1.5 → 5.1.6
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 +8 -0
- package/dist/cjs/ui/DatePicker/index.js +8 -3
- package/dist/cjs/ui/DatePicker/utils/internal.js +32 -1
- package/dist/es2019/ui/DatePicker/index.js +7 -2
- package/dist/es2019/ui/DatePicker/utils/internal.js +25 -0
- package/dist/esm/ui/DatePicker/index.js +8 -3
- package/dist/esm/ui/DatePicker/utils/internal.js +29 -0
- package/dist/types/ui/DatePicker/utils/internal.d.ts +11 -0
- package/dist/types-ts4.5/ui/DatePicker/utils/internal.d.ts +11 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-date
|
|
2
2
|
|
|
3
|
+
## 5.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`45b7e7965939b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/45b7e7965939b) -
|
|
8
|
+
[ux] [I18N-2877] add locale to datepicker i18n and day of week
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.1.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -24,8 +24,10 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
24
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
26
|
var _colors = require("@atlaskit/theme/colors");
|
|
27
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
27
28
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
28
29
|
var _datePickerInput = _interopRequireDefault(require("./date-picker-input"));
|
|
30
|
+
var _internal = require("./utils/internal");
|
|
29
31
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
30
32
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
33
|
var PopupWithListeners = (0, _ui.withOuterListeners)(_ui.Popup);
|
|
@@ -101,7 +103,8 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
101
103
|
return (0, _createClass2.default)(DatePicker, [{
|
|
102
104
|
key: "render",
|
|
103
105
|
value: function render() {
|
|
104
|
-
var
|
|
106
|
+
var _getDFLocale,
|
|
107
|
+
_this2 = this;
|
|
105
108
|
var _this$props = this.props,
|
|
106
109
|
element = _this$props.element,
|
|
107
110
|
_onSelect = _this$props.onSelect,
|
|
@@ -131,6 +134,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
131
134
|
if (!timestamp) {
|
|
132
135
|
return null;
|
|
133
136
|
}
|
|
137
|
+
var defaultWeekStartDay = (0, _expValEquals.expValEquals)('platform_editor_locale_datepicker', 'isEnabled', true) ? (_getDFLocale = (0, _internal.getDFLocale)(intl.locale)) === null || _getDFLocale === void 0 || (_getDFLocale = _getDFLocale.options) === null || _getDFLocale === void 0 ? void 0 : _getDFLocale.weekStartsOn : undefined;
|
|
134
138
|
return /*#__PURE__*/_react.default.createElement(PopupWithListeners
|
|
135
139
|
// Ignored via go/ees005
|
|
136
140
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -176,8 +180,9 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
176
180
|
year: year,
|
|
177
181
|
selected: selected,
|
|
178
182
|
ref: _this2.handleRef,
|
|
179
|
-
weekStartDay: weekStartDay,
|
|
180
|
-
testId: 'datepicker'
|
|
183
|
+
weekStartDay: weekStartDay !== null && weekStartDay !== void 0 ? weekStartDay : defaultWeekStartDay,
|
|
184
|
+
testId: 'datepicker',
|
|
185
|
+
locale: intl.locale
|
|
181
186
|
}));
|
|
182
187
|
}));
|
|
183
188
|
}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.adjustDate = adjustDate;
|
|
8
9
|
exports.findDateSegmentByPosition = findDateSegmentByPosition;
|
|
10
|
+
exports.getDFLocale = getDFLocale;
|
|
9
11
|
exports.getLocaleDatePlaceholder = getLocaleDatePlaceholder;
|
|
10
12
|
exports.isDatePossiblyValid = isDatePossiblyValid;
|
|
11
13
|
exports.isToday = isToday;
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
15
|
var _addDays = _interopRequireDefault(require("date-fns/addDays"));
|
|
13
16
|
var _addMonths = _interopRequireDefault(require("date-fns/addMonths"));
|
|
14
17
|
var _addYears = _interopRequireDefault(require("date-fns/addYears"));
|
|
18
|
+
var locales = _interopRequireWildcard(require("date-fns/locale"));
|
|
15
19
|
var _formatParse = require("./formatParse");
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
21
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
17
22
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } // eslint-disable-next-line import/no-namespace
|
|
19
24
|
function isDigit(c) {
|
|
20
25
|
if (c === undefined) {
|
|
21
26
|
return false;
|
|
@@ -186,4 +191,30 @@ function adjustDate(date, activeSegment, adjustment) {
|
|
|
186
191
|
function isToday(date) {
|
|
187
192
|
var today = new Date();
|
|
188
193
|
return date !== undefined && today.getDate() === date.day && date.month === today.getMonth() + 1 && date.year === today.getFullYear();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get the corresponding date-fns locale for a given locale string. Ideally we could rely on Intl
|
|
198
|
+
* but firefox does not support getting the first day of the week from it. We have to handle silly
|
|
199
|
+
* use cases like 'nl-NL' where the language code is the same as the region code because someone
|
|
200
|
+
* decided to format them in this non-standard way
|
|
201
|
+
* @param localeString Locale string, eg. 'en-AU'
|
|
202
|
+
* @returns Locale or undefined if not found
|
|
203
|
+
* @example
|
|
204
|
+
* getDFLocale('en-AU') // returns enAU locale
|
|
205
|
+
*/
|
|
206
|
+
function getDFLocale(localeString) {
|
|
207
|
+
var dfLocaleString = localeString;
|
|
208
|
+
var _localeString$split = localeString.split('-'),
|
|
209
|
+
_localeString$split2 = (0, _slicedToArray2.default)(_localeString$split, 2),
|
|
210
|
+
lang = _localeString$split2[0],
|
|
211
|
+
region = _localeString$split2[1];
|
|
212
|
+
if (region) {
|
|
213
|
+
if (lang.toLocaleLowerCase() === region.toLocaleLowerCase()) {
|
|
214
|
+
dfLocaleString = lang;
|
|
215
|
+
} else {
|
|
216
|
+
dfLocaleString = "".concat(lang).concat(region);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return locales[dfLocaleString];
|
|
189
220
|
}
|
|
@@ -12,9 +12,11 @@ import { timestampToIsoFormat, timestampToUTCDate } from '@atlaskit/editor-commo
|
|
|
12
12
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { N0, N60A } from '@atlaskit/theme/colors';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
16
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
16
17
|
const PopupWithListeners = withOuterListeners(Popup);
|
|
17
18
|
import DatePickerInput from './date-picker-input';
|
|
19
|
+
import { getDFLocale } from './utils/internal';
|
|
18
20
|
|
|
19
21
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
20
22
|
const popupContentWrapper = null;
|
|
@@ -84,6 +86,7 @@ class DatePicker extends React.Component {
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
render() {
|
|
89
|
+
var _getDFLocale, _getDFLocale$options;
|
|
87
90
|
const {
|
|
88
91
|
element,
|
|
89
92
|
onSelect,
|
|
@@ -117,6 +120,7 @@ class DatePicker extends React.Component {
|
|
|
117
120
|
if (!timestamp) {
|
|
118
121
|
return null;
|
|
119
122
|
}
|
|
123
|
+
const defaultWeekStartDay = expValEquals('platform_editor_locale_datepicker', 'isEnabled', true) ? (_getDFLocale = getDFLocale(intl.locale)) === null || _getDFLocale === void 0 ? void 0 : (_getDFLocale$options = _getDFLocale.options) === null || _getDFLocale$options === void 0 ? void 0 : _getDFLocale$options.weekStartsOn : undefined;
|
|
120
124
|
return /*#__PURE__*/React.createElement(PopupWithListeners
|
|
121
125
|
// Ignored via go/ees005
|
|
122
126
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -155,8 +159,9 @@ class DatePicker extends React.Component {
|
|
|
155
159
|
year: year,
|
|
156
160
|
selected: selected,
|
|
157
161
|
ref: this.handleRef,
|
|
158
|
-
weekStartDay: weekStartDay,
|
|
159
|
-
testId: 'datepicker'
|
|
162
|
+
weekStartDay: weekStartDay !== null && weekStartDay !== void 0 ? weekStartDay : defaultWeekStartDay,
|
|
163
|
+
testId: 'datepicker',
|
|
164
|
+
locale: intl.locale
|
|
160
165
|
}))));
|
|
161
166
|
}
|
|
162
167
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import addDays from 'date-fns/addDays';
|
|
2
2
|
import addMonths from 'date-fns/addMonths';
|
|
3
3
|
import addYears from 'date-fns/addYears';
|
|
4
|
+
// eslint-disable-next-line import/no-namespace
|
|
5
|
+
import * as locales from 'date-fns/locale';
|
|
4
6
|
import { dateToDateType, dateTypeToDate, formatDateType } from './formatParse';
|
|
5
7
|
function isDigit(c) {
|
|
6
8
|
if (c === undefined) {
|
|
@@ -161,4 +163,27 @@ export function adjustDate(date, activeSegment, adjustment) {
|
|
|
161
163
|
export function isToday(date) {
|
|
162
164
|
const today = new Date();
|
|
163
165
|
return date !== undefined && today.getDate() === date.day && date.month === today.getMonth() + 1 && date.year === today.getFullYear();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the corresponding date-fns locale for a given locale string. Ideally we could rely on Intl
|
|
170
|
+
* but firefox does not support getting the first day of the week from it. We have to handle silly
|
|
171
|
+
* use cases like 'nl-NL' where the language code is the same as the region code because someone
|
|
172
|
+
* decided to format them in this non-standard way
|
|
173
|
+
* @param localeString Locale string, eg. 'en-AU'
|
|
174
|
+
* @returns Locale or undefined if not found
|
|
175
|
+
* @example
|
|
176
|
+
* getDFLocale('en-AU') // returns enAU locale
|
|
177
|
+
*/
|
|
178
|
+
export function getDFLocale(localeString) {
|
|
179
|
+
let dfLocaleString = localeString;
|
|
180
|
+
const [lang, region] = localeString.split('-');
|
|
181
|
+
if (region) {
|
|
182
|
+
if (lang.toLocaleLowerCase() === region.toLocaleLowerCase()) {
|
|
183
|
+
dfLocaleString = lang;
|
|
184
|
+
} else {
|
|
185
|
+
dfLocaleString = `${lang}${region}`;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return locales[dfLocaleString];
|
|
164
189
|
}
|
|
@@ -19,9 +19,11 @@ import { timestampToIsoFormat, timestampToUTCDate } from '@atlaskit/editor-commo
|
|
|
19
19
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
20
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
21
|
import { N0, N60A } from '@atlaskit/theme/colors';
|
|
22
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
23
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
23
24
|
var PopupWithListeners = withOuterListeners(Popup);
|
|
24
25
|
import DatePickerInput from './date-picker-input';
|
|
26
|
+
import { getDFLocale } from './utils/internal';
|
|
25
27
|
|
|
26
28
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
27
29
|
var popupContentWrapper = null;
|
|
@@ -95,7 +97,8 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
95
97
|
return _createClass(DatePicker, [{
|
|
96
98
|
key: "render",
|
|
97
99
|
value: function render() {
|
|
98
|
-
var
|
|
100
|
+
var _getDFLocale,
|
|
101
|
+
_this2 = this;
|
|
99
102
|
var _this$props = this.props,
|
|
100
103
|
element = _this$props.element,
|
|
101
104
|
_onSelect = _this$props.onSelect,
|
|
@@ -125,6 +128,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
125
128
|
if (!timestamp) {
|
|
126
129
|
return null;
|
|
127
130
|
}
|
|
131
|
+
var defaultWeekStartDay = expValEquals('platform_editor_locale_datepicker', 'isEnabled', true) ? (_getDFLocale = getDFLocale(intl.locale)) === null || _getDFLocale === void 0 || (_getDFLocale = _getDFLocale.options) === null || _getDFLocale === void 0 ? void 0 : _getDFLocale.weekStartsOn : undefined;
|
|
128
132
|
return /*#__PURE__*/React.createElement(PopupWithListeners
|
|
129
133
|
// Ignored via go/ees005
|
|
130
134
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -170,8 +174,9 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
170
174
|
year: year,
|
|
171
175
|
selected: selected,
|
|
172
176
|
ref: _this2.handleRef,
|
|
173
|
-
weekStartDay: weekStartDay,
|
|
174
|
-
testId: 'datepicker'
|
|
177
|
+
weekStartDay: weekStartDay !== null && weekStartDay !== void 0 ? weekStartDay : defaultWeekStartDay,
|
|
178
|
+
testId: 'datepicker',
|
|
179
|
+
locale: intl.locale
|
|
175
180
|
}));
|
|
176
181
|
}));
|
|
177
182
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
5
|
import addDays from 'date-fns/addDays';
|
|
5
6
|
import addMonths from 'date-fns/addMonths';
|
|
6
7
|
import addYears from 'date-fns/addYears';
|
|
8
|
+
// eslint-disable-next-line import/no-namespace
|
|
9
|
+
import * as locales from 'date-fns/locale';
|
|
7
10
|
import { dateToDateType, dateTypeToDate, formatDateType } from './formatParse';
|
|
8
11
|
function isDigit(c) {
|
|
9
12
|
if (c === undefined) {
|
|
@@ -175,4 +178,30 @@ export function adjustDate(date, activeSegment, adjustment) {
|
|
|
175
178
|
export function isToday(date) {
|
|
176
179
|
var today = new Date();
|
|
177
180
|
return date !== undefined && today.getDate() === date.day && date.month === today.getMonth() + 1 && date.year === today.getFullYear();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get the corresponding date-fns locale for a given locale string. Ideally we could rely on Intl
|
|
185
|
+
* but firefox does not support getting the first day of the week from it. We have to handle silly
|
|
186
|
+
* use cases like 'nl-NL' where the language code is the same as the region code because someone
|
|
187
|
+
* decided to format them in this non-standard way
|
|
188
|
+
* @param localeString Locale string, eg. 'en-AU'
|
|
189
|
+
* @returns Locale or undefined if not found
|
|
190
|
+
* @example
|
|
191
|
+
* getDFLocale('en-AU') // returns enAU locale
|
|
192
|
+
*/
|
|
193
|
+
export function getDFLocale(localeString) {
|
|
194
|
+
var dfLocaleString = localeString;
|
|
195
|
+
var _localeString$split = localeString.split('-'),
|
|
196
|
+
_localeString$split2 = _slicedToArray(_localeString$split, 2),
|
|
197
|
+
lang = _localeString$split2[0],
|
|
198
|
+
region = _localeString$split2[1];
|
|
199
|
+
if (region) {
|
|
200
|
+
if (lang.toLocaleLowerCase() === region.toLocaleLowerCase()) {
|
|
201
|
+
dfLocaleString = lang;
|
|
202
|
+
} else {
|
|
203
|
+
dfLocaleString = "".concat(lang).concat(region);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return locales[dfLocaleString];
|
|
178
207
|
}
|
|
@@ -30,3 +30,14 @@ export declare function getLocaleDatePlaceholder(locale: string): string | undef
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function adjustDate(date: DateType, activeSegment: DateSegment, adjustment: number): DateType;
|
|
32
32
|
export declare function isToday(date: DateType | undefined): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get the corresponding date-fns locale for a given locale string. Ideally we could rely on Intl
|
|
35
|
+
* but firefox does not support getting the first day of the week from it. We have to handle silly
|
|
36
|
+
* use cases like 'nl-NL' where the language code is the same as the region code because someone
|
|
37
|
+
* decided to format them in this non-standard way
|
|
38
|
+
* @param localeString Locale string, eg. 'en-AU'
|
|
39
|
+
* @returns Locale or undefined if not found
|
|
40
|
+
* @example
|
|
41
|
+
* getDFLocale('en-AU') // returns enAU locale
|
|
42
|
+
*/
|
|
43
|
+
export declare function getDFLocale(localeString: string): Locale | undefined;
|
|
@@ -30,3 +30,14 @@ export declare function getLocaleDatePlaceholder(locale: string): string | undef
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function adjustDate(date: DateType, activeSegment: DateSegment, adjustment: number): DateType;
|
|
32
32
|
export declare function isToday(date: DateType | undefined): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get the corresponding date-fns locale for a given locale string. Ideally we could rely on Intl
|
|
35
|
+
* but firefox does not support getting the first day of the week from it. We have to handle silly
|
|
36
|
+
* use cases like 'nl-NL' where the language code is the same as the region code because someone
|
|
37
|
+
* decided to format them in this non-standard way
|
|
38
|
+
* @param localeString Locale string, eg. 'en-AU'
|
|
39
|
+
* @returns Locale or undefined if not found
|
|
40
|
+
* @example
|
|
41
|
+
* getDFLocale('en-AU') // returns enAU locale
|
|
42
|
+
*/
|
|
43
|
+
export declare function getDFLocale(localeString: string): Locale | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-date",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"description": "Date plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/textfield": "^8.0.0",
|
|
50
50
|
"@atlaskit/theme": "^19.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^11.3.0",
|
|
52
52
|
"@atlaskit/tokens": "^6.0.0",
|
|
53
53
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|