@tactics/toddle-styleguide 1.2.7 → 1.2.9
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/App.tsx +5 -0
- package/index.d.ts +3 -1
- package/index.tsx +50 -46
- package/package.json +1 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +628 -1810
- package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +72 -1
- package/src/components/atoms/quick-message/quick-message.component.d.ts +2 -1
- package/src/components/atoms/quick-message/quick-message.component.tsx +3 -1
- package/src/components/atoms/quick-message/quick-message.preview.tsx +10 -1
- package/src/components/atoms/quick-message/quick-message.styles.d.ts +1 -1
- package/src/components/atoms/quick-message/quick-message.styles.js +4 -2
- package/src/components/atoms/quick-message/quick-message.test.js +38 -6
- package/src/components/atoms/text-input/text-input.component.tsx +6 -9
- package/src/components/atoms/text-input/text-input.preview.tsx +3 -3
- package/src/components/atoms/text-input/text-input.styles.d.ts +20 -44
- package/src/components/atoms/text-input/text-input.styles.js +7 -13
- package/src/components/molecules/button/button.styles.d.ts +17 -13
- package/src/components/molecules/day/day.component.tsx +17 -4
- package/src/components/molecules/day/day.styles.d.ts +27 -44
- package/src/components/molecules/day/day.styles.js +14 -17
- package/src/components/molecules/filter-tab/filter-tab.component.d.ts +3 -2
- package/src/components/molecules/filter-tab/filter-tab.component.tsx +9 -5
- package/src/components/molecules/filter-tab/filter-tab.preview.tsx +2 -2
- package/src/components/molecules/filter-tab/filter-tab.test.js +2 -2
- package/src/components/molecules/password-input/password-input.component.tsx +7 -9
- package/src/components/molecules/password-input/password-input.styles.d.ts +27 -26
- package/src/components/molecules/password-input/password-input.styles.js +6 -6
- package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +23 -13
- package/src/components/molecules/search-input/search.component.d.ts +7 -8
- package/src/components/molecules/search-input/search.component.tsx +19 -30
- package/src/components/molecules/search-input/search.preview.tsx +8 -6
- package/src/components/molecules/search-input/search.styles.d.ts +31 -30
- package/src/components/molecules/search-input/search.styles.js +14 -8
- package/src/components/molecules/search-input/search.test.js +3 -1
- package/src/components/molecules/send-bubble/send-text-bubble.component.tsx +1 -5
- package/src/components/molecules/send-bubble/send-text-bubble.styles.d.ts +58 -74
- package/src/components/molecules/send-bubble/send-text-bubble.styles.js +2 -8
- package/src/components/molecules/timeline/timeline.styles.d.ts +40 -50
- package/src/components/molecules/timeline/timeline.styles.js +2 -2
- package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -1
- package/src/components/molecules/timestamp/timestamp.component.tsx +4 -7
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +165 -14
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -1
- package/src/components/organisms/child-list-item/child-list-item.component.tsx +24 -1
- package/src/components/organisms/child-list-item/child-list-item.preview.tsx +12 -0
- package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +35 -41
- package/src/components/organisms/child-list-item/child-list-item.styles.js +2 -5
- package/src/components/organisms/child-list-item/child-list-item.test.js +9 -4
- package/src/components/organisms/child-list-item/components/child-list-tag.component.d.ts +6 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.component.tsx +28 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.d.ts +10 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.js +16 -0
- package/src/components/organisms/day-select/day-select.preview.tsx +9 -5
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +143 -401
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +4 -5
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.tsx +32 -59
- package/src/components/organisms/my-child-list-item/my-child-list-item.preview.tsx +37 -24
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +32 -28
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.js +16 -12
- package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +5 -22
- package/src/components/organisms/person-info-card/person-info-card.component.d.ts +2 -1
- package/src/components/organisms/person-info-card/person-info-card.component.tsx +3 -0
- package/src/components/organisms/tab-view/__snapshots__/tab-view.test.js.snap +421 -0
- package/src/components/organisms/tab-view/tab-view.component.d.ts +11 -0
- package/src/components/organisms/tab-view/tab-view.component.tsx +48 -0
- package/src/components/organisms/tab-view/tab-view.preview.d.ts +1 -0
- package/src/components/organisms/tab-view/tab-view.preview.tsx +36 -0
- package/src/components/organisms/tab-view/tab-view.styles.d.ts +10 -0
- package/src/components/organisms/tab-view/tab-view.styles.js +14 -0
- package/src/components/organisms/tab-view/tab-view.test.js +37 -0
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +2 -1
- package/src/components/organisms/text-bubble/text-bubble.component.tsx +3 -1
- package/src/components/organisms/text-bubble/text-bubble.preview.tsx +8 -4
- package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +1 -0
- package/src/components/organisms/text-bubble/text-bubble.styles.js +2 -0
- package/src/components/templates/modal/components/fade-panel.component.tsx +1 -1
- package/src/components/templates/popover/components/modal/modal.component.d.ts +2 -1
- package/src/components/templates/popover/components/modal/modal.component.tsx +8 -2
- package/src/components/templates/popover/popover.component.d.ts +2 -1
- package/src/components/templates/popover/popover.component.tsx +3 -0
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +4 -0
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +6 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +10 -2
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +31 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +114 -84
- package/src/utilities/toddle-datetime/types/{duration-like.type.d.ts → duration.type.d.ts} +2 -0
- package/src/utilities/toddle-datetime/types/{duration-like.type.tsx → duration.type.tsx} +3 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +1 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +8 -1
|
@@ -6,6 +6,7 @@ type PopoverModalProps = {
|
|
|
6
6
|
isVisible: boolean;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
windowHeight: number;
|
|
9
|
+
disableSrollContent?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const Modal: ({ isVisible, title, subtitle, onClose, children, windowHeight, }: PopoverModalProps) => JSX.Element;
|
|
11
|
+
declare const Modal: ({ isVisible, title, subtitle, onClose, children, windowHeight, disableSrollContent, }: PopoverModalProps) => JSX.Element;
|
|
11
12
|
export { Modal as Modal };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {useContext, useMemo, useState} from 'react';
|
|
3
|
-
import {Animated} from 'react-native';
|
|
3
|
+
import {Animated, View} from 'react-native';
|
|
4
4
|
import {Stylesheet} from './modal.styles';
|
|
5
5
|
import {Close} from './close/close.component';
|
|
6
6
|
import {Heading} from './heading/heading.component';
|
|
@@ -14,6 +14,7 @@ type PopoverModalProps = {
|
|
|
14
14
|
isVisible: boolean;
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
windowHeight: number;
|
|
17
|
+
disableSrollContent?: boolean;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const Modal = ({
|
|
@@ -23,6 +24,7 @@ const Modal = ({
|
|
|
23
24
|
onClose,
|
|
24
25
|
children,
|
|
25
26
|
windowHeight,
|
|
27
|
+
disableSrollContent,
|
|
26
28
|
}: PopoverModalProps) => {
|
|
27
29
|
// Keep element and window size in local state.
|
|
28
30
|
const [elementSize, setElementSize] = useState({width: 0, height: 0});
|
|
@@ -78,7 +80,11 @@ const Modal = ({
|
|
|
78
80
|
<Close onPress={onClose} />
|
|
79
81
|
<Animated.View style={styles.inner}>
|
|
80
82
|
{title ? <Heading title={title} subtitle={subtitle} /> : null}
|
|
81
|
-
|
|
83
|
+
{disableSrollContent ? (
|
|
84
|
+
<View>{children}</View>
|
|
85
|
+
) : (
|
|
86
|
+
<ScrollContent>{children}</ScrollContent>
|
|
87
|
+
)}
|
|
82
88
|
</Animated.View>
|
|
83
89
|
</Animated.View>
|
|
84
90
|
);
|
|
@@ -5,6 +5,7 @@ type PopoverProps = {
|
|
|
5
5
|
subtitle?: string;
|
|
6
6
|
isVisible: boolean;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
disableScrollContent?: boolean;
|
|
8
9
|
};
|
|
9
|
-
declare const Popover: ({ isVisible, title, subtitle, onClose, children, }: PopoverProps) => JSX.Element;
|
|
10
|
+
declare const Popover: ({ isVisible, title, subtitle, onClose, children, disableScrollContent, }: PopoverProps) => JSX.Element;
|
|
10
11
|
export { Popover as Popover };
|
|
@@ -11,6 +11,7 @@ type PopoverProps = {
|
|
|
11
11
|
subtitle?: string;
|
|
12
12
|
isVisible: boolean;
|
|
13
13
|
children?: React.ReactNode;
|
|
14
|
+
disableScrollContent?: boolean;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const Popover = ({
|
|
@@ -19,6 +20,7 @@ const Popover = ({
|
|
|
19
20
|
subtitle,
|
|
20
21
|
onClose,
|
|
21
22
|
children,
|
|
23
|
+
disableScrollContent,
|
|
22
24
|
}: PopoverProps) => {
|
|
23
25
|
const [windowHeight, setWindowHeight] = useState(
|
|
24
26
|
Dimensions.get('window').height
|
|
@@ -55,6 +57,7 @@ const Popover = ({
|
|
|
55
57
|
onClose={onClose}
|
|
56
58
|
title={title}
|
|
57
59
|
subtitle={subtitle}
|
|
60
|
+
disableSrollContent={disableScrollContent}
|
|
58
61
|
>
|
|
59
62
|
{children}
|
|
60
63
|
</Modal>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConversionAccuracy } from '../types/toddle-datetime.type';
|
|
1
2
|
export interface LocaleOptions {
|
|
2
3
|
/**
|
|
3
4
|
* @default system's locale
|
|
@@ -16,3 +17,6 @@ export interface DateTimeOptions extends LocaleOptions {
|
|
|
16
17
|
*/
|
|
17
18
|
setZone?: boolean | undefined;
|
|
18
19
|
}
|
|
20
|
+
export interface DiffOptions {
|
|
21
|
+
conversionAccuracy?: ConversionAccuracy | undefined;
|
|
22
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {ConversionAccuracy} from '../types/toddle-datetime.type';
|
|
2
|
+
|
|
1
3
|
export interface LocaleOptions {
|
|
2
4
|
/**
|
|
3
5
|
* @default system's locale
|
|
@@ -17,3 +19,7 @@ export interface DateTimeOptions extends LocaleOptions {
|
|
|
17
19
|
*/
|
|
18
20
|
setZone?: boolean | undefined;
|
|
19
21
|
}
|
|
22
|
+
|
|
23
|
+
export interface DiffOptions {
|
|
24
|
+
conversionAccuracy?: ConversionAccuracy | undefined;
|
|
25
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Duration as LuxonDuration } from 'luxon';
|
|
2
|
+
import { LocaleOptions, DateTimeOptions, DiffOptions } from './interfaces/toddle-datetime.interface';
|
|
3
|
+
import { DurationLike, DurationUnits } from './types/duration.type';
|
|
3
4
|
import { DateTimeFormatOptions, DateTimeJSOptions, DateTimeUnit } from './types/toddle-datetime.type';
|
|
5
|
+
import { DurationObjectUnits } from './interfaces/duration.interface';
|
|
6
|
+
export declare class Duration {
|
|
7
|
+
private duration;
|
|
8
|
+
constructor(duration: LuxonDuration);
|
|
9
|
+
toObject(): DurationObjectUnits;
|
|
10
|
+
}
|
|
4
11
|
export declare class ToddleDateTime {
|
|
5
12
|
private dateTime;
|
|
6
13
|
private constructor();
|
|
@@ -39,4 +46,5 @@ export declare class ToddleDateTime {
|
|
|
39
46
|
toString(): string;
|
|
40
47
|
toLocaleString(formatOptions?: DateTimeFormatOptions, options?: LocaleOptions): string;
|
|
41
48
|
timestamp(): number;
|
|
49
|
+
diff(otherDateTime: ToddleDateTime, unit?: DurationUnits, options?: DiffOptions): Duration;
|
|
42
50
|
}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import {DateTime as LuxonDateTime} from 'luxon';
|
|
1
|
+
import {DateTime as LuxonDateTime, Duration as LuxonDuration} from 'luxon';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
LocaleOptions,
|
|
5
5
|
DateTimeOptions,
|
|
6
|
+
DiffOptions,
|
|
6
7
|
} from './interfaces/toddle-datetime.interface';
|
|
7
8
|
|
|
8
|
-
import {DurationLike} from './types/duration
|
|
9
|
+
import {DurationLike, DurationUnits} from './types/duration.type';
|
|
9
10
|
import {
|
|
10
11
|
DateTimeFormatOptions,
|
|
11
12
|
DateTimeJSOptions,
|
|
12
13
|
DateTimeUnit,
|
|
13
14
|
} from './types/toddle-datetime.type';
|
|
15
|
+
import {DurationObjectUnits} from './interfaces/duration.interface';
|
|
16
|
+
|
|
17
|
+
export class Duration {
|
|
18
|
+
private duration: LuxonDuration;
|
|
19
|
+
|
|
20
|
+
constructor(duration: LuxonDuration) {
|
|
21
|
+
this.duration = duration;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
toObject(): DurationObjectUnits {
|
|
25
|
+
return this.duration.toObject();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
14
28
|
|
|
15
29
|
export class ToddleDateTime {
|
|
16
30
|
private dateTime: LuxonDateTime;
|
|
@@ -174,4 +188,19 @@ export class ToddleDateTime {
|
|
|
174
188
|
timestamp(): number {
|
|
175
189
|
return this.dateTime.toUnixInteger();
|
|
176
190
|
}
|
|
191
|
+
|
|
192
|
+
// COMPARE
|
|
193
|
+
|
|
194
|
+
diff(
|
|
195
|
+
otherDateTime: ToddleDateTime,
|
|
196
|
+
unit?: DurationUnits,
|
|
197
|
+
options?: DiffOptions
|
|
198
|
+
): Duration {
|
|
199
|
+
const luxonDuration = this.dateTime.diff(
|
|
200
|
+
otherDateTime.dateTime,
|
|
201
|
+
unit,
|
|
202
|
+
options
|
|
203
|
+
);
|
|
204
|
+
return new Duration(luxonDuration);
|
|
205
|
+
}
|
|
177
206
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {ToddleDateTime} from './toddle-datetime.class';
|
|
3
|
-
import {
|
|
3
|
+
import {ScrollView, View} from 'react-native';
|
|
4
4
|
import {Paragraph} from '../../components/atoms/paragraph-components';
|
|
5
5
|
import {Heading2, Heading4} from '../../components/atoms/heading-components';
|
|
6
6
|
|
|
@@ -12,97 +12,36 @@ export const ToddleDateTimePreview = ({}: {}) => {
|
|
|
12
12
|
return (
|
|
13
13
|
<View
|
|
14
14
|
style={{
|
|
15
|
-
marginTop:
|
|
15
|
+
marginTop: 24,
|
|
16
16
|
alignContent: 'center',
|
|
17
17
|
justifyContent: 'center',
|
|
18
|
-
paddingBottom:
|
|
18
|
+
paddingBottom: 100,
|
|
19
19
|
}}
|
|
20
20
|
>
|
|
21
21
|
<Heading2 bold={true} textAlign={'center'} addStyle={{marginBottom: 50}}>
|
|
22
22
|
ToddleDateTime
|
|
23
23
|
</Heading2>
|
|
24
|
+
<Heading4 addStyle={{paddingHorizontal: 16, marginBottom: 24}}>
|
|
25
|
+
ToddleDateTime is a wrapper around Luxon, and provides less
|
|
26
|
+
functionality. This can and or will expand through time. You can find
|
|
27
|
+
the implemented methods below:
|
|
28
|
+
</Heading4>
|
|
24
29
|
<ScrollView contentContainerStyle={{padding: 16}}>
|
|
25
30
|
<Heading4 bold={true}>.now()</Heading4>
|
|
26
|
-
<Paragraph addStyle={{marginBottom: 12}}>
|
|
31
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
32
|
+
Create a DateTime for the current instant, in the system's time zone.
|
|
33
|
+
</Paragraph>
|
|
27
34
|
|
|
28
35
|
<Heading4 bold={true}>
|
|
29
36
|
.fromISO(date: string, options?: DateTimeOptions)
|
|
30
37
|
</Heading4>
|
|
31
38
|
<Paragraph addStyle={{marginBottom: 12}}>
|
|
32
|
-
|
|
33
|
-
{'\n'}
|
|
34
|
-
{fromISO.toString()}
|
|
35
|
-
{'\n'}
|
|
36
|
-
{'\n'}
|
|
37
|
-
Date time in a zone with the fromISO method
|
|
38
|
-
{'\n'}
|
|
39
|
-
Europe/Brussels
|
|
40
|
-
{'\n'}
|
|
41
|
-
{ToddleDateTime.fromISO(fromISO.toString(), {
|
|
42
|
-
zone: 'Europe/Brussels',
|
|
43
|
-
}).toString()}
|
|
44
|
-
{'\n'}
|
|
45
|
-
{'\n'}
|
|
46
|
-
America/Los_Angeles
|
|
47
|
-
{'\n'}
|
|
48
|
-
{ToddleDateTime.fromISO(fromISO.toString(), {
|
|
49
|
-
zone: 'America/Los_Angeles',
|
|
50
|
-
}).toString()}
|
|
39
|
+
Create a ToddleDateTime from an ISO 8601 string
|
|
51
40
|
</Paragraph>
|
|
52
41
|
|
|
53
42
|
<Heading4 bold={true}>.local()</Heading4>
|
|
54
|
-
<Paragraph
|
|
55
|
-
|
|
56
|
-
local now
|
|
57
|
-
{'\n'}
|
|
58
|
-
{ToddleDateTime.local().toISO()}
|
|
59
|
-
{'\n'}
|
|
60
|
-
{'\n'}
|
|
61
|
-
local now in US east coast time
|
|
62
|
-
{'\n'}
|
|
63
|
-
{ToddleDateTime.local({zone: 'America/New_York'}).toISO()}
|
|
64
|
-
{'\n'}
|
|
65
|
-
{'\n'}
|
|
66
|
-
year
|
|
67
|
-
{'\n'}
|
|
68
|
-
{ToddleDateTime.local(1989).toISO()}
|
|
69
|
-
{'\n'}
|
|
70
|
-
{'\n'}
|
|
71
|
-
year and month
|
|
72
|
-
{'\n'}
|
|
73
|
-
{ToddleDateTime.local(1989, 8).toISO()}
|
|
74
|
-
{'\n'}
|
|
75
|
-
{'\n'}
|
|
76
|
-
year, month and day with a French locale
|
|
77
|
-
{'\n'}
|
|
78
|
-
{ToddleDateTime.local(1989, 8, 9, {locale: 'fr'}).toISO()}
|
|
79
|
-
{'\n'}
|
|
80
|
-
{'\n'}
|
|
81
|
-
year, month, day and hour
|
|
82
|
-
{'\n'}
|
|
83
|
-
{ToddleDateTime.local(1989, 8, 9, 23).toISO()}
|
|
84
|
-
{'\n'}
|
|
85
|
-
{'\n'}
|
|
86
|
-
year, month, day and hour in UTC
|
|
87
|
-
{'\n'}
|
|
88
|
-
{ToddleDateTime.local(1989, 8, 9, 23, {zone: 'utc'}).toISO()}
|
|
89
|
-
{'\n'}
|
|
90
|
-
{'\n'}
|
|
91
|
-
year, month, day, hour and minutes
|
|
92
|
-
{'\n'}
|
|
93
|
-
{ToddleDateTime.local(1989, 8, 9, 23, 45).toISO()}
|
|
94
|
-
{'\n'}
|
|
95
|
-
{'\n'}
|
|
96
|
-
year, month, day, hour, minutes and seconds
|
|
97
|
-
{'\n'}
|
|
98
|
-
{ToddleDateTime.local(1989, 8, 9, 23, 45, 10).toISO()}
|
|
99
|
-
{'\n'}
|
|
100
|
-
{'\n'}
|
|
101
|
-
year, month, day, hour, minutes, seconds and milliseconds
|
|
102
|
-
{'\n'}
|
|
103
|
-
{ToddleDateTime.local(1989, 8, 9, 23, 45, 10, 782).toISO()}
|
|
104
|
-
{'\n'}
|
|
105
|
-
{'\n'}
|
|
43
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
44
|
+
Create a local ToddleDateTime
|
|
106
45
|
</Paragraph>
|
|
107
46
|
|
|
108
47
|
<Heading4 bold={true}>.timestamp()</Heading4>
|
|
@@ -114,15 +53,106 @@ export const ToddleDateTimePreview = ({}: {}) => {
|
|
|
114
53
|
</Paragraph>
|
|
115
54
|
|
|
116
55
|
<Heading4 bold={true}>.fromSeconds(seconds, options?)</Heading4>
|
|
117
|
-
<Paragraph
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
56
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
57
|
+
Create a ToddleDateTime from a number of seconds since the epoch
|
|
58
|
+
(meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
|
|
59
|
+
</Paragraph>
|
|
60
|
+
|
|
61
|
+
<Heading4 bold={true}>.DATE_MED()</Heading4>
|
|
62
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
63
|
+
ToddleDateTime.toLocaleString format like 'Oct 14, 1983'
|
|
64
|
+
</Paragraph>
|
|
65
|
+
|
|
66
|
+
<Heading4 bold={true}>.hour()</Heading4>
|
|
67
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
68
|
+
Get the hour of the day (0-23)
|
|
69
|
+
</Paragraph>
|
|
70
|
+
|
|
71
|
+
<Heading4 bold={true}>.minute()</Heading4>
|
|
72
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
73
|
+
Get the minute of the hour (0-59).
|
|
74
|
+
</Paragraph>
|
|
75
|
+
|
|
76
|
+
<Heading4 bold={true}>.second()</Heading4>
|
|
77
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
78
|
+
Get the second of the minute (0-59).
|
|
79
|
+
</Paragraph>
|
|
80
|
+
|
|
81
|
+
<Heading4 bold={true}>.millisecond()</Heading4>
|
|
82
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
83
|
+
Get the millisecond of the second (0-999).
|
|
84
|
+
</Paragraph>
|
|
85
|
+
|
|
86
|
+
<Heading4 bold={true}>.day()</Heading4>
|
|
87
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
88
|
+
Get the day of the month (1-30ish).
|
|
89
|
+
</Paragraph>
|
|
90
|
+
|
|
91
|
+
<Heading4 bold={true}>.weekdayShort()</Heading4>
|
|
92
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
93
|
+
Get the human readable short weekday, such as 'Mon'. Defaults to the
|
|
94
|
+
system's locale if no locale has been specified
|
|
95
|
+
</Paragraph>
|
|
96
|
+
|
|
97
|
+
<Heading4 bold={true}>.plus(duration)</Heading4>
|
|
98
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
99
|
+
{`Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, dt.plus({ hours: 24 }) may result in a different time than dt.plus({ days: 1 }) if there's a DST shift in between.`}
|
|
100
|
+
</Paragraph>
|
|
101
|
+
|
|
102
|
+
<Heading4 bold={true}>.minus(duration)</Heading4>
|
|
103
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
104
|
+
See ToddleDateTime plus()
|
|
105
|
+
</Paragraph>
|
|
106
|
+
|
|
107
|
+
<Heading4 bold={true}>.startOf(unit)</Heading4>
|
|
108
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
109
|
+
"Set" this ToddleDateTime to the beginning of the given unit.
|
|
110
|
+
</Paragraph>
|
|
111
|
+
|
|
112
|
+
<Heading4 bold={true}>.endOf(unit)</Heading4>
|
|
113
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
114
|
+
"Set" this ToddleDateTime to the end (meaning the last millisecond) of
|
|
115
|
+
a unit of time
|
|
116
|
+
</Paragraph>
|
|
117
|
+
|
|
118
|
+
<Heading4 bold={true}>.toFormat(format, options?)</Heading4>
|
|
119
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
120
|
+
Returns a string representation of this ToddleDateTime formatted
|
|
121
|
+
according to the specified format string.
|
|
122
|
+
</Paragraph>
|
|
123
|
+
|
|
124
|
+
<Heading4 bold={true}>.toISO()</Heading4>
|
|
125
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
126
|
+
Returns an ISO 8601-compliant string representation of this
|
|
127
|
+
ToddleDateTime
|
|
128
|
+
</Paragraph>
|
|
129
|
+
|
|
130
|
+
<Heading4 bold={true}>.toISODate()</Heading4>
|
|
131
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
132
|
+
Returns an ISO 8601-compliant string representation of this
|
|
133
|
+
ToddleDateTime's date component
|
|
134
|
+
</Paragraph>
|
|
135
|
+
|
|
136
|
+
<Heading4 bold={true}>.toString()</Heading4>
|
|
137
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
138
|
+
Returns a string representation of this DateTime appropriate for
|
|
139
|
+
debugging
|
|
140
|
+
</Paragraph>
|
|
141
|
+
|
|
142
|
+
<Heading4 bold={true}>
|
|
143
|
+
.toLocaleString(formatOptions?, options?)
|
|
144
|
+
</Heading4>
|
|
145
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
146
|
+
Returns a localized string representing this date.
|
|
147
|
+
</Paragraph>
|
|
148
|
+
|
|
149
|
+
<Heading4 bold={true}>.timestamp()</Heading4>
|
|
150
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
151
|
+
Returns the epoch seconds (as a whole number) of this ToddleDateTime.{' '}
|
|
152
|
+
</Paragraph>
|
|
153
|
+
<Heading4 bold={true}>.diff(otherDateTime, unit?, options?)</Heading4>
|
|
154
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
155
|
+
Return the difference between two ToddleDateTimes as a Duration.
|
|
126
156
|
</Paragraph>
|
|
127
157
|
</ScrollView>
|
|
128
158
|
</View>
|
|
@@ -2,3 +2,4 @@ import { DateTimeOptions } from '../interfaces/toddle-datetime.interface';
|
|
|
2
2
|
export type DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
|
3
3
|
export type DateTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
4
4
|
export type DateTimeJSOptions = Omit<DateTimeOptions, 'setZone'>;
|
|
5
|
+
export type ConversionAccuracy = 'casual' | 'longterm';
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DateTimeOptions,
|
|
3
|
+
LocaleOptions,
|
|
4
|
+
} from '../interfaces/toddle-datetime.interface';
|
|
5
|
+
import {CanBeInvalid} from 'luxon/src/_util';
|
|
6
|
+
import {_ToObjectOutput} from 'luxon';
|
|
2
7
|
|
|
3
8
|
export type DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
|
4
9
|
|
|
@@ -14,3 +19,5 @@ export type DateTimeUnit =
|
|
|
14
19
|
| 'millisecond';
|
|
15
20
|
|
|
16
21
|
export type DateTimeJSOptions = Omit<DateTimeOptions, 'setZone'>;
|
|
22
|
+
|
|
23
|
+
export type ConversionAccuracy = 'casual' | 'longterm';
|