@atlaskit/editor-plugin-date 13.0.14 → 13.0.16
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 +12 -0
- package/datePlugin/package.json +1 -8
- package/datePluginType/package.json +1 -8
- package/package.json +2 -2
- package/types/package.json +1 -8
- package/dist/types-ts4.5/datePlugin.d.ts +0 -3
- package/dist/types-ts4.5/datePluginType.d.ts +0 -21
- package/dist/types-ts4.5/entry-points/datePlugin.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/datePluginType.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -3
- package/dist/types-ts4.5/nodeviews/DateNodeView.d.ts +0 -34
- package/dist/types-ts4.5/nodeviews/dateNodeSpec.d.ts +0 -26
- package/dist/types-ts4.5/nodeviews/utils.d.ts +0 -8
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -13
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +0 -8
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -8
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/types.d.ts +0 -14
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -5
- package/dist/types-ts4.5/types/index.d.ts +0 -49
- package/dist/types-ts4.5/ui/DatePicker/date-picker-input.d.ts +0 -28
- package/dist/types-ts4.5/ui/DatePicker/index.d.ts +0 -39
- package/dist/types-ts4.5/ui/DatePicker/utils/formatParse.d.ts +0 -27
- package/dist/types-ts4.5/ui/DatePicker/utils/internal.d.ts +0 -43
package/CHANGELOG.md
CHANGED
package/datePlugin/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/datePlugin.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/datePlugin.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/datePlugin.d.ts"
|
|
17
10
|
}
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/datePluginType.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/datePluginType.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/datePluginType.d.ts"
|
|
17
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-date",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.16",
|
|
4
4
|
"description": "Date plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/locale": "^4.1.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/textfield": "^8.3.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^103.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^13.4.0",
|
|
48
48
|
"@atlaskit/visually-hidden": "^3.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
package/types/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/types.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/types.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/types.d.ts"
|
|
17
10
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
4
|
-
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
|
-
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
|
-
import type { DatePluginOptions, DatePluginSharedState, DeleteDate, InsertDate } from './types';
|
|
7
|
-
export type DatePluginDependencies = [
|
|
8
|
-
typeof analyticsPlugin,
|
|
9
|
-
EditorDisabledPlugin,
|
|
10
|
-
OptionalPlugin<AnnotationPlugin>,
|
|
11
|
-
OptionalPlugin<EditorViewModePlugin>
|
|
12
|
-
];
|
|
13
|
-
export type DatePlugin = NextEditorPlugin<'date', {
|
|
14
|
-
commands: {
|
|
15
|
-
deleteDate: DeleteDate;
|
|
16
|
-
insertDate: InsertDate;
|
|
17
|
-
};
|
|
18
|
-
dependencies: DatePluginDependencies;
|
|
19
|
-
pluginConfiguration: DatePluginOptions | undefined;
|
|
20
|
-
sharedState: DatePluginSharedState;
|
|
21
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as datePlugin } from '../datePlugin';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { DatePlugin, DatePluginDependencies } from '../datePluginType';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { DatePluginSharedState, DatePluginConfig, DatePluginOptions, DateType, InsertDate, } from '../types/index';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { Decoration, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export declare class DateNodeView implements NodeView {
|
|
10
|
-
dom: Node;
|
|
11
|
-
private node;
|
|
12
|
-
private readonly intl;
|
|
13
|
-
private readonly view;
|
|
14
|
-
private readonly getPos;
|
|
15
|
-
private parentTaskState;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param node
|
|
19
|
-
* @param view
|
|
20
|
-
* @param getPos
|
|
21
|
-
* @param intl
|
|
22
|
-
* @param decorations
|
|
23
|
-
* @example
|
|
24
|
-
*/
|
|
25
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, intl: IntlShape, decorations: ReadonlyArray<Decoration>);
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param node
|
|
29
|
-
* @param decorations
|
|
30
|
-
* @example
|
|
31
|
-
*/
|
|
32
|
-
update(node: PMNode, decorations: ReadonlyArray<Decoration>): boolean;
|
|
33
|
-
private static getParentTaskState;
|
|
34
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export declare const dateNodeSpec: (node: PMNode) => DOMOutputSpec;
|
|
6
|
-
export declare const dateToDOM: (node: PMNode, state: EditorState, getPos: getPosHandlerNode, intl: IntlShape) => [
|
|
7
|
-
string,
|
|
8
|
-
Record<string, string>,
|
|
9
|
-
(string | {
|
|
10
|
-
class: string;
|
|
11
|
-
} | (string | {
|
|
12
|
-
class: string;
|
|
13
|
-
})[])[],
|
|
14
|
-
(string | Record<string, string> | (string | {
|
|
15
|
-
class: string;
|
|
16
|
-
style: string;
|
|
17
|
-
})[])[],
|
|
18
|
-
((string | {
|
|
19
|
-
class: string;
|
|
20
|
-
contentEditable: string;
|
|
21
|
-
} | (string | {
|
|
22
|
-
class: string;
|
|
23
|
-
})[])[] | (string | {
|
|
24
|
-
class: string;
|
|
25
|
-
})[])
|
|
26
|
-
];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
type DateInformation = {
|
|
4
|
-
color: 'red' | undefined;
|
|
5
|
-
displayString: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const getDateInformation: (timestamp: string | number, intl: IntlShape, state?: EditorState, pos?: number) => DateInformation;
|
|
8
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Command, CommandDispatch, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { DatePlugin, DateType } from '../types';
|
|
4
|
-
export declare const createDate: (isQuickInsertAction?: boolean) => (state: EditorState) => Transaction;
|
|
5
|
-
/** Focus input */
|
|
6
|
-
export declare const focusDateInput: () => (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
|
|
7
|
-
export declare const setDatePickerAt: (showDatePickerAt: number | null) => (state: EditorState, dispatch: (tr: Transaction) => void) => boolean;
|
|
8
|
-
export declare const closeDatePicker: () => Command;
|
|
9
|
-
export declare const closeDatePickerWithAnalytics: ({ date, pluginInjectionApi, }: {
|
|
10
|
-
date?: DateType;
|
|
11
|
-
pluginInjectionApi?: ExtractInjectionAPI<DatePlugin>;
|
|
12
|
-
}) => Command;
|
|
13
|
-
export declare const openDatePicker: () => Command;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { DatePlugin, DeleteDate, InsertDate } from '../types';
|
|
3
|
-
type DeleteDateCommand = (pluginInjectionApi: ExtractInjectionAPI<DatePlugin> | undefined) => DeleteDate;
|
|
4
|
-
/** Delete the date and close the datepicker */
|
|
5
|
-
export declare const deleteDateCommand: DeleteDateCommand;
|
|
6
|
-
type InsertDateCommand = (pluginInjectionApi: ExtractInjectionAPI<DatePlugin> | undefined) => InsertDate;
|
|
7
|
-
export declare const insertDateCommand: InsertDateCommand;
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { DatePluginState } from './types';
|
|
5
|
-
declare const getPluginState: (state: EditorState) => DatePluginState;
|
|
6
|
-
declare const createPlugin: (pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<DatePluginState>;
|
|
7
|
-
export { getPluginState };
|
|
8
|
-
export default createPlugin;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type DatePluginState = {
|
|
2
|
-
focusDateInput: boolean;
|
|
3
|
-
isDateEmpty: boolean;
|
|
4
|
-
isInitialised: boolean;
|
|
5
|
-
isNew: boolean;
|
|
6
|
-
isQuickInsertAction?: boolean;
|
|
7
|
-
showDatePickerAt: number | null;
|
|
8
|
-
};
|
|
9
|
-
export type DatePluginMeta = {
|
|
10
|
-
isDateEmpty?: boolean;
|
|
11
|
-
isInitialised: boolean;
|
|
12
|
-
isNew?: boolean;
|
|
13
|
-
showDatePickerAt?: number | null;
|
|
14
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { DatePluginMeta, DatePluginState } from './types';
|
|
3
|
-
export declare function reducer(pluginState: DatePluginState, meta: DatePluginMeta): DatePluginState;
|
|
4
|
-
export declare function mapping(tr: ReadonlyTransaction, pluginState: DatePluginState): DatePluginState;
|
|
5
|
-
export declare function onSelectionChanged(tr: ReadonlyTransaction, pluginState: DatePluginState): DatePluginState;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { WeekDay } from '@atlaskit/calendar/types';
|
|
2
|
-
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { EditorCommand, NextEditorPlugin, OptionalPlugin, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
-
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
6
|
-
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
|
-
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
8
|
-
export type DateSegment = 'day' | 'month' | 'year';
|
|
9
|
-
export type DateType = {
|
|
10
|
-
day?: number;
|
|
11
|
-
month: number;
|
|
12
|
-
year: number;
|
|
13
|
-
};
|
|
14
|
-
export interface DatePluginOptions {
|
|
15
|
-
weekStartDay?: WeekDay;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @private
|
|
19
|
-
* @deprecated Use {@link DatePluginOptions} instead.
|
|
20
|
-
* @see https://product-fabric.atlassian.net/browse/ED-27496
|
|
21
|
-
*/
|
|
22
|
-
export type DatePluginConfig = DatePluginOptions;
|
|
23
|
-
export type DatePluginSharedState = {
|
|
24
|
-
focusDateInput: boolean;
|
|
25
|
-
isInitialised: boolean;
|
|
26
|
-
isNew: boolean;
|
|
27
|
-
showDatePickerAt?: number | null;
|
|
28
|
-
};
|
|
29
|
-
export type InsertDate = (props: {
|
|
30
|
-
commitMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.KEYBOARD;
|
|
31
|
-
date?: DateType;
|
|
32
|
-
enterPressed?: boolean;
|
|
33
|
-
inputMethod?: TOOLBAR_MENU_TYPE;
|
|
34
|
-
}) => EditorCommand;
|
|
35
|
-
export type DeleteDate = EditorCommand;
|
|
36
|
-
export type DatePlugin = NextEditorPlugin<'date', {
|
|
37
|
-
commands: {
|
|
38
|
-
deleteDate: DeleteDate;
|
|
39
|
-
insertDate: InsertDate;
|
|
40
|
-
};
|
|
41
|
-
dependencies: [
|
|
42
|
-
typeof analyticsPlugin,
|
|
43
|
-
EditorDisabledPlugin,
|
|
44
|
-
OptionalPlugin<AnnotationPlugin>,
|
|
45
|
-
OptionalPlugin<EditorViewModePlugin>
|
|
46
|
-
];
|
|
47
|
-
pluginConfiguration: DatePluginOptions | undefined;
|
|
48
|
-
sharedState: DatePluginSharedState;
|
|
49
|
-
}>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
|
|
7
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import type { DateType } from '../../types';
|
|
9
|
-
export interface InputProps {
|
|
10
|
-
/** Automatically focus the text field */
|
|
11
|
-
autoFocus?: boolean;
|
|
12
|
-
/** Automatically select all text in the field. Requires autoFocus to be true. */
|
|
13
|
-
autoSelectAll?: boolean;
|
|
14
|
-
date: DateType;
|
|
15
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
16
|
-
/** Locale code string (eg. "en-AU") */
|
|
17
|
-
locale: string;
|
|
18
|
-
onEmptySubmit: () => void;
|
|
19
|
-
onNewDate: (date: DateType) => void;
|
|
20
|
-
onSubmitDate: (date: DateType | null) => void;
|
|
21
|
-
}
|
|
22
|
-
export interface InputState {
|
|
23
|
-
inputText: string;
|
|
24
|
-
}
|
|
25
|
-
declare const _default_1: React.FC<WithIntlProps<InputProps & WrappedComponentProps>> & {
|
|
26
|
-
WrappedComponent: React.ComponentType<InputProps & WrappedComponentProps>;
|
|
27
|
-
};
|
|
28
|
-
export default _default_1;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
|
|
7
|
-
import type { WeekDay } from '@atlaskit/calendar/types';
|
|
8
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import type { DateType } from '../../types';
|
|
11
|
-
export interface Props {
|
|
12
|
-
/** Whether to automatically focus the input */
|
|
13
|
-
autoFocus?: boolean;
|
|
14
|
-
boundariesElement?: HTMLElement;
|
|
15
|
-
closeDatePicker: () => void;
|
|
16
|
-
closeDatePickerWithAnalytics: ({ date }: {
|
|
17
|
-
date?: DateType;
|
|
18
|
-
}) => void;
|
|
19
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
20
|
-
element: HTMLElement | null;
|
|
21
|
-
/** Whether the date is newly created, selcting and focusing the input */
|
|
22
|
-
isNew: boolean;
|
|
23
|
-
mountTo?: HTMLElement;
|
|
24
|
-
onDelete: () => void;
|
|
25
|
-
onSelect: (date: DateType | null, commitMethod: INPUT_METHOD.PICKER | INPUT_METHOD.KEYBOARD) => void;
|
|
26
|
-
onTextChanged: (date: DateType) => void;
|
|
27
|
-
scrollableElement?: HTMLElement;
|
|
28
|
-
weekStartDay?: WeekDay;
|
|
29
|
-
}
|
|
30
|
-
export interface State {
|
|
31
|
-
date: DateType;
|
|
32
|
-
latestValidDate: DateType;
|
|
33
|
-
selected: Array<string>;
|
|
34
|
-
setInputSelectionPos?: number;
|
|
35
|
-
}
|
|
36
|
-
declare const _default_1: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
|
|
37
|
-
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
38
|
-
};
|
|
39
|
-
export default _default_1;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { DateType } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Attempt to parse a string representing a date in a particular locale to a date object
|
|
4
|
-
* @param dateString The string representing the date in the given locale, eg '02/12/2000'
|
|
5
|
-
* @param l10n The localisation provider created by createLocalizationProvider
|
|
6
|
-
* @returns Editor DateType when can parse, null when can't parse or invalid
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseDateType(dateString: string, locale: string): DateType | null;
|
|
9
|
-
/**
|
|
10
|
-
* Convert an EditorDateType to a date string string formatted for a particular locale
|
|
11
|
-
* @param date The date object
|
|
12
|
-
* @param locale The locale code string (eg. "en-AU")
|
|
13
|
-
* @returns Date string, eg "25/5/20"
|
|
14
|
-
*/
|
|
15
|
-
export declare function formatDateType(date: DateType, locale: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Convert an Editor DateType to a JavaScript Date object
|
|
18
|
-
* @param date Editor DateType
|
|
19
|
-
* @returns JavaScript Date object
|
|
20
|
-
*/
|
|
21
|
-
export declare function dateTypeToDate(date: DateType): Date;
|
|
22
|
-
/**
|
|
23
|
-
* Convert a JavaScript Date to an editor DateType
|
|
24
|
-
* @param date JavaScript Date object
|
|
25
|
-
* @returns Editor DateType
|
|
26
|
-
*/
|
|
27
|
-
export declare function dateToDateType(date: Date): DateType;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { DateSegment, DateType } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Inconclusively check if a date string is valid - a value of false means it is definitely
|
|
4
|
-
* invalid, a value of true means it might be valid.
|
|
5
|
-
* @param date Date string to be parsed
|
|
6
|
-
*/
|
|
7
|
-
export declare function isDatePossiblyValid(date: string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Find the segment of a date a position refers to. Eg: pos 2 in 29/03/2020 is in
|
|
10
|
-
* the day segment.
|
|
11
|
-
* @param position Cursor position, with 0 referring to the left of the first char
|
|
12
|
-
* @param date The localised date string
|
|
13
|
-
* @param locale The language to interpret the date string in
|
|
14
|
-
*/
|
|
15
|
-
export declare function findDateSegmentByPosition(position: number, date: string, locale: string): DateSegment | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Generate a placeholder date string for a given locale
|
|
18
|
-
* eg: locale 'hu-HU' -> 'yyyy. mm. dd.'
|
|
19
|
-
* @param locale A locale string supported by Intl.DateTimeFormat
|
|
20
|
-
* @returns A placeholder string. d=1 or 2 digit day, dd=zero padded
|
|
21
|
-
* day, same for month but letter m, yyyy=year
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLocaleDatePlaceholder(locale: string): string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Adjust date segment up or down. Eg. If day is the active segment and adjustment is -1,
|
|
26
|
-
* reduce the day by one.
|
|
27
|
-
* @param date Valid datetype
|
|
28
|
-
* @param activeSegment which part of the date is selected/being adjusted
|
|
29
|
-
* @param adjustment how many units the segment is being adjusted (can be pos or neg, usually 1 or -1)
|
|
30
|
-
*/
|
|
31
|
-
export declare function adjustDate(date: DateType, activeSegment: DateSegment, adjustment: number): DateType;
|
|
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;
|