Skip to content

Commit b533ca0

Browse files
committed
Fix plugin import examples and update terminology in docs
1 parent 419a6fd commit b533ca0

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

docs/migration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ format(new Date(), 'ddd, MMM DD YYYY hh:mm A [GMT]Z', { timeZone: 'UTC' });
3737
// => Fri, Jan 02 2015 07:14 AM GMT+0000
3838
```
3939

40-
Additionally, since the `timezone` plugin has been integrated into the main library, the `formatTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
40+
Additionally, since the `timezone` plugin has been integrated into the main library, the `formatTZ` function is now obsolete. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
4141

4242
```typescript
4343
import { format } from 'date-and-time';
@@ -58,7 +58,7 @@ parse('11:14:05 PM', 'h:mm:ss A', { timeZone: 'UTC' });
5858
// => Jan 02 1970 23:14:05 GMT+0000
5959
```
6060

61-
Additionally, since the `timezone` plugin has been integrated into the main library, the `parseTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
61+
Additionally, since the `timezone` plugin has been integrated into the main library, the `parseTZ` function is now obsolete. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
6262

6363
```typescript
6464
import { parse } from 'date-and-time';
@@ -99,7 +99,7 @@ Additionally, the `PreparseResult` object returned by the `preparse` function ha
9999

100100
### isValid
101101

102-
The following usage that takes `PreparseResult` as an argument has been deprecated.
102+
The following usage that takes `PreparseResult` as an argument is now obsolete.
103103

104104
```typescript
105105
import { isValid, preparse } from 'date-and-time';
@@ -114,7 +114,7 @@ Other changes are the same as for the `parse` function.
114114

115115
### transform
116116

117-
The fourth argument has been changed from `boolean` to `FormatterOptions`. With `FormatterOptions`, you can now specify timezone and locale settings. Additionally, `ParserOptions` has been added as a parameter before `FormatterOptions`. Since the `timezone` plugin has been integrated into the main library, the `transformTZ` function has been deprecated.
117+
The fourth argument has been changed from `boolean` to `FormatterOptions`. With `FormatterOptions`, you can now specify timezone and locale settings. Additionally, `ParserOptions` has been added as a parameter before `FormatterOptions`. Since the `timezone` plugin has been integrated into the main library, the `transformTZ` function is now obsolete.
118118

119119
```typescript
120120
import { transform } from 'date-and-time';
@@ -147,7 +147,7 @@ addYears(now, 1, 'UTC');
147147
// => Mar 11 2025 01:00:00 GMT+0000
148148
```
149149

150-
Additionally, since the `timezone` plugin has been integrated into the main library, the `addYearsTZ` function has been deprecated. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
150+
Additionally, since the `timezone` plugin has been integrated into the main library, the `addYearsTZ` function is now obsolete. Timezones are now imported as modules rather than using `IANA time zone names` (except for UTC timezone).
151151

152152
```typescript
153153
import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
@@ -187,7 +187,7 @@ subtract(yesterday, today).toMilliseconds().value; // => 86400000
187187

188188
### timeSpan
189189

190-
The `timespan` plugin has been deprecated as it has been integrated into the main library's `subtract` function. Please note that the argument order of the `subtract` function has changed. You can achieve the same output as before as follows:
190+
The `timespan` plugin is now obsolete as it has been integrated into the main library's `subtract` function. Please note that the argument order of the `subtract` function has changed. You can achieve the same output as before as follows:
191191

192192
```typescript
193193
import { subtract } from 'date-and-time';
@@ -219,7 +219,7 @@ format(new Date(), 'dddd, D [de] MMMM [de] YYYY, h:mm aa [GMT]ZZ', { locale: es
219219

220220
## Plugins
221221

222-
The following plugins have been deprecated as they have been integrated into the main library:
222+
The following plugins are now obsolete as they have been integrated into the main library:
223223

224224
- `meridiem`
225225
- `timespan`

docs/plugins.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
```typescript
1010
import { format } from 'date-and-time';
11-
import foobar from 'date-and-time/plugins/foobar';
11+
import { formatter as foobar } from 'date-and-time/plugins/foobar';
1212

1313
format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar] });
1414
```
@@ -19,7 +19,7 @@ format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar] });
1919
const { format } = require('date-and-time');
2020
const foobar = require('date-and-time/plugins/foobar');
2121

22-
format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar] });
22+
format(new Date(), 'ddd, MMM DD YYYY', { plugins: [foobar.formatter] });
2323
```
2424

2525
## Plugin List
@@ -39,7 +39,7 @@ You can add tokens to the `Parser` to read day of the week. Since day of the wee
3939

4040
```typescript
4141
import { parse } from 'date-and-time';
42-
import day_of_week from 'date-and-time/plugins/day_of_week';
42+
import { parser as day_of_week } from 'date-and-time/plugins/day_of_week';
4343

4444
parse(
4545
'Thursday, March 05, 2020', 'dddd, MMMM, D YYYY',
@@ -67,7 +67,7 @@ You can add tokens to the `Parser` to read microseconds. Since the precision of
6767

6868
```typescript
6969
import { parse } from 'date-and-time';
70-
import microsecond from 'date-and-time/plugins/microsecond';
70+
import { parser as microsecond } from 'date-and-time/plugins/microsecond';
7171

7272
parse('12:34:56.123456', 'HH:mm:ss.SSSSSS', { plugins: [microsecond] });
7373
parse('12:34:56 123.456', 'HH:mm:ss SSS.fff', { plugins: [microsecond] });
@@ -93,8 +93,8 @@ You can add tokens to the `Parser` to read nanoseconds. Since the precision of J
9393

9494
```typescript
9595
import { parse } from 'date-and-time';
96-
import microsecond from 'date-and-time/plugins/microsecond';
97-
import nanosecond from 'date-and-time/plugins/nanosecond';
96+
import { parser as microsecond } from 'date-and-time/plugins/microsecond';
97+
import { parser as nanosecond } from 'date-and-time/plugins/nanosecond';
9898

9999
parse(
100100
'12:34:56.123456789',
@@ -124,7 +124,7 @@ You can add tokens to the `Formatter` and `Parser` to output or read ordinal rep
124124

125125
```typescript
126126
import { format } from 'date-and-time';
127-
import ordinal from 'date-and-time/plugins/ordinal';
127+
import { formatter as ordinal } from 'date-and-time/plugins/ordinal';
128128

129129
format(new Date(), 'MMM DDD YYYY', { plugins: [ordinal] });
130130
// => Jan 1st 2019
@@ -138,7 +138,7 @@ format(new Date(), 'MMM DDD YYYY', { plugins: [ordinal] });
138138

139139
```typescript
140140
import { parse } from 'date-and-time';
141-
import ordinal from 'date-and-time/plugins/ordinal';
141+
import { parser as ordinal } from 'date-and-time/plugins/ordinal';
142142

143143
parse('Jan 1st 2019', 'MMM DDD YYYY', { plugins: [ordinal] });
144144
```
@@ -161,7 +161,7 @@ You can add tokens to the `Parser` to read 2-digit years. This token identifies
161161

162162
```typescript
163163
import { parse } from 'date-and-time';
164-
import two_digit_year from 'date-and-time/plugins/two-digit-year';
164+
import { parser as two_digit_year } from 'date-and-time/plugins/two-digit-year';
165165

166166
parse('Dec 25 69', 'MMM DD YY', { plugins: [two_digit_year] });
167167
// => Dec 25 2069
@@ -185,7 +185,7 @@ You can add tokens to the `Formatter` to output timezone names. These timezone n
185185

186186
```typescript
187187
import { parse } from 'date-and-time';
188-
import zonename from 'date-and-time/plugins/zonename';
188+
import { formatter as zonename } from 'date-and-time/plugins/zonename';
189189
import Tokyo from 'date-and-time/timezones/Asia/Tokyo';
190190

191191
format(

0 commit comments

Comments
 (0)