Skip to content

Commit 89ce553

Browse files
authored
Merge pull request #92 from phueper/master
update, dependencies, plugin mechanism, packages names, ...
2 parents 54c21fd + 90171c7 commit 89ce553

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+17191
-15689
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"presets": [
33
[
4-
"env"
4+
"@babel/preset-env"
55
]
66
],
77
"plugins": [

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
Changelog
22
=========
33

4-
### next (1.1.0)
4+
### next (2.0.0)
5+
6+
#### public API
7+
8+
introduced new plugin concept
9+
* Hide `use(plug)` concept from public api.
10+
The function for extending js-joda is not exported anymore (the default export of this module is removed).
11+
The code for extending js-joda `use(plug)` is not required anymore, because js-joda-timezone automaticaly extends
12+
js-joda when imported.
513

614
* get rid of postinstall build
715

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ also see examples in [examples folder](examples/)
2424

2525
Since the process described [below](#without-prebuilt-locale-packages) requires a lot of setup and internal knowledge,
2626
we provide prebuilt sets of locales as separate npm packages.
27-
So for ease of use you may want to install the corresponding `js-joda-locale_<locale>` package.
27+
So for ease of use you may want to install the corresponding `@js-joda/locale_<locale>` package.
2828
The current list of available prebuilt locales is:
2929
- de (i.e. de-*)
3030
- de-DE

dist/js-joda-locale.js

Lines changed: 1831 additions & 1679 deletions
Large diffs are not rendered by default.

dist/js-joda-locale.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js-joda-locale.min.js

Lines changed: 47 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/usage_browser.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,19 @@
8282
let outputDateInDifferentLocales = function (zdt) {
8383
output('Times in ' + zdt.zone());
8484
output('&nbsp;');
85-
output('en_US formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.US)));
86-
output('en_CA formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.CANADA)));
87-
output('en_GB formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.UK)));
88-
output('de_DE formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.GERMANY)));
89-
output('fr_FR formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.FRANCE)));
90-
output('es_ES formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('es', 'ES ', 'es'))));
91-
output('ru_RU formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('ru', 'RU ', 'ru'))));
92-
output('zh_CN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('zh', 'CN ', 'zh'))));
93-
output('hi_IN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('hi', 'IN ', 'hi'))));
85+
output('en_US formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.US)));
86+
output('en_CA formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.CANADA)));
87+
output('en_GB formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.UK)));
88+
output('de_DE formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.GERMANY)));
89+
output('fr_FR formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.FRANCE)));
90+
output('es_ES formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('es', 'ES ', 'es'))));
91+
output('ru_RU formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('ru', 'RU ', 'ru'))));
92+
output('zh_CN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('zh', 'CN ', 'zh'))));
93+
output('hi_IN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('hi', 'IN ', 'hi'))));
9494
output('&nbsp;');
9595
output('<hr />');
9696
}
9797

98-
JSJoda = JSJoda.use(JSJodaTimezone).use(JSJodaLocale);
9998
var zdt = JSJoda.ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, JSJoda.ZoneId.of('Europe/Berlin'));
10099
outputDateInDifferentLocales(zdt)
101100
zdt = JSJoda.ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, JSJoda.ZoneId.of('America/Chicago'));

examples/usage_browser_build.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,19 @@
3939
function outputDateInDifferentLocales(zdt) {
4040
output('Times in ' + zdt.zone());
4141
output('&nbsp;');
42-
output('en_US formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.US)));
43-
output('en_CA formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.CANADA)));
44-
output('en_GB formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.UK)));
45-
output('de_DE formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.GERMANY)));
46-
output('fr_FR formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJoda.Locale.FRANCE)));
47-
output('es_ES formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('es', 'ES ', 'es'))));
48-
output('ru_RU formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('ru', 'RU ', 'ru'))));
49-
output('zh_CN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('zh', 'CN ', 'zh'))));
50-
output('hi_IN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJoda.Locale('hi', 'IN ', 'hi'))));
42+
output('en_US formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.US)));
43+
output('en_CA formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.CANADA)));
44+
output('en_GB formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.UK)));
45+
output('de_DE formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.GERMANY)));
46+
output('fr_FR formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(JSJodaLocale.Locale.FRANCE)));
47+
output('es_ES formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('es', 'ES ', 'es'))));
48+
output('ru_RU formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('ru', 'RU ', 'ru'))));
49+
output('zh_CN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('zh', 'CN ', 'zh'))));
50+
output('hi_IN formatted string: ' + zdt.format(JSJoda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, zz, OOOO \'Week: \' ww, \'Quarter: \' QQQ').withLocale(new JSJodaLocale.Locale('hi', 'IN ', 'hi'))));
5151
output('&nbsp;');
5252
output('<hr />');
5353
}
5454

55-
JSJoda = JSJoda.use(JSJodaTimezone).use(JSJodaLocale);
5655
var zdt = JSJoda.ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, JSJoda.ZoneId.of('Europe/Berlin'));
5756
outputDateInDifferentLocales(zdt)
5857
zdt = JSJoda.ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, JSJoda.ZoneId.of('America/Chicago'));

examples/usage_es6.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
44
*/
55
/* eslint-disable no-console, no-var */
6-
import { use as jsJodaUse } from 'js-joda';
7-
import jsJodaTimeZone from 'js-joda-timezone';
8-
import jsJodaLocale from '../dist/js-joda-locale';
9-
10-
const { DateTimeFormatter, Locale, ZonedDateTime, ZoneId } = jsJodaUse(jsJodaTimeZone).use(jsJodaLocale);
6+
import { DateTimeFormatter, ZonedDateTime, ZoneId } from 'js-joda';
7+
import 'js-joda-timezone';
8+
import { Locale } from './build/js-joda-locale';
119

1210
const zdt = ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneId.of('Europe/Berlin'));
1311
// var zdt = joda.ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, joda.ZoneId.of('America/Chicago'));

examples/usage_node.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
44
*/
55
/* eslint-disable no-console, no-var */
6-
const joda = require('js-joda')
7-
.use(require('js-joda-timezone'))
8-
.use(require('../dist/js-joda-locale'));
6+
const joda = require('js-joda');
7+
require('js-joda-timezone');
98

109
const {
1110
DateTimeFormatter,
1211
Instant,
13-
Locale,
1412
ZonedDateTime,
1513
ZoneId,
1614
} = joda;
1715

16+
const {
17+
Locale,
18+
} = require('./build/js-joda-locale');
19+
20+
1821
const zdt = ZonedDateTime.of(2016, 1, 1, 1, 2, 3, 4, ZoneId.of('Europe/Berlin'));
1922
const pattern = 'eeee MMMM dd yyyy GGGG, hh:mm:ss,nnnn a zzzz, \'Week \' ww, \'Quarter \' QQQ';
2023
const enUSFormatter = DateTimeFormatter.ofPattern(pattern).withLocale(Locale.US);

0 commit comments

Comments
 (0)