Skip to content

Commit c63599b

Browse files
committed
Update Readme
1 parent bf37bbd commit c63599b

File tree

1 file changed

+42
-30
lines changed

1 file changed

+42
-30
lines changed

README.md

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
## Motivation
1212

13+
Implementation of the js-joda ZoneRulesProvider, providing the
1314
bindings to the iana tzdb, using latest zone file generated by moment-timezone
1415

1516
## Usage
@@ -19,19 +20,29 @@ bindings to the iana tzdb, using latest zone file generated by moment-timezone
1920
Install joda using npm
2021

2122
npm install js-joda
23+
npm install js-joda-timezone
2224

23-
Then require it
25+
Require it
2426

2527
jsJoda = require('js-joda')
2628
.use(require('js-joda-timezone'))
2729

2830
const {LocalDateTime, ZoneId, ZonedDateTime } = jsJoda;
29-
30-
const zone = ZoneId.of('Europe/Berlin')
31-
const zdt = LocalDateTime.parse('2016-06-30T11:30').atZone(zone) // 2016-06-30T11:30+02:00[Europe/Berlin]
32-
ZonedDateTime.parse('2016-06-30T11:30+02:00[Europe/Berlin]') // 2016-06-30T11:30+02:00[Europe/Berlin]
33-
zdt.withZoneSameInstant(ZoneId.of('America/New_York')) // 2016-06-30T05:30-04:00[America/New_York]
34-
zdt.withZoneSameLocal(ZoneId.of('America/New_York')) // 2016-06-30T11:30-04:00[America/New_York]
31+
32+
LocalDateTime
33+
.parse('2016-06-30T11:30')
34+
.atZone(ZoneId.of('Europe/Berlin'))
35+
.toString() // 2016-06-30T11:30+02:00[Europe/Berlin]
36+
37+
ZonedDateTime
38+
.parse('2016-06-30T11:30+02:00[Europe/Berlin]')
39+
.withZoneSameInstant(ZoneId.of('America/New_York'))
40+
.toString() // 2016-06-30T05:30-04:00[America/New_York]
41+
42+
ZonedDateTime
43+
.parse('2016-06-30T11:30+02:00[Europe/Berlin]')
44+
.withZoneSameLocal(ZoneId.of('America/New_York'))
45+
.toString() // 2016-06-30T11:30-04:00[America/New_York]
3546

3647
### Browser
3748

@@ -43,34 +54,35 @@ Then require it
4354

4455
// copy all js-joda classes to the global scope
4556
for(let key in JSJoda) { this[key] = JSJoda[key]; }
46-
47-
const zone = ZoneId.of('Europe/Berlin')
48-
let zdt = LocalDateTime.parse('2016-06-30T11:30').atZone(zone)
49-
console.log(zdt.toString()) // 2016-06-30T11:30+02:00[Europe/Berlin]
50-
51-
zdt = ZonedDateTime.parse('2016-06-30T11:30+02:00[Europe/Berlin]')
52-
console.log(zdt.toString()) // 2016-06-30T11:30+02:00[Europe/Berlin]
53-
54-
zdtl = zdt.withZoneSameInstant(ZoneId.of('America/New_York'))
55-
console.log(zdtl.toString()) // 2016-06-30T05:30-04:00[America/New_York]
56-
57-
zdti = zdt.withZoneSameLocal(ZoneId.of('America/New_York'))
58-
console.log(zdti.toString()) // 2016-06-30T11:30-04:00[America/New_York]
57+
58+
LocalDateTime
59+
.parse('2016-06-30T11:30')
60+
.atZone(ZoneId.of('Europe/Berlin'))
61+
.toString() // 2016-06-30T11:30+02:00[Europe/Berlin]
62+
63+
ZonedDateTime
64+
.parse('2016-06-30T11:30+02:00[Europe/Berlin]')
65+
.withZoneSameInstant(ZoneId.of('America/New_York'))
66+
.toString() // 2016-06-30T05:30-04:00[America/New_York]
67+
68+
ZonedDateTime
69+
.parse('2016-06-30T11:30+02:00[Europe/Berlin]')
70+
.withZoneSameLocal(ZoneId.of('America/New_York'))
71+
.toString() // 2016-06-30T11:30-04:00[America/New_York]
5972
</script>
6073

6174
## Known Issues
6275

63-
The package is incomplete, has pure test coverage and work is in progress.
64-
65-
* ZoneDateTime methods should work correctly, except for calculations during a daylight saving
66-
transition
67-
* LocalDate.atStartOfDay(zone) might return wrong date if the start of day is within a daylight saving
68-
transition. (very rare case like at gaza)
69-
* ZoneRules only implement methods that are required by js-joda core, there is still functionality missing
70-
* other ZoneRules methods (like standardOffset) are not supported
76+
* This ZoneRulesProvider implemantion supplies all functionality that is required from the js-joda core
77+
library.
78+
* Additional ZoneRules functionality like get all transitions, etc is not implemented.
7179

7280
## License
7381

74-
+ js-joda-timezone is released under the [BSD 3-clause license](LICENSE):
82+
* js-joda-timezone is released under the [BSD 3-clause license](LICENSE):
83+
84+
* The author of joda time and the lead architect of the JSR-310 is Stephen Colebourne.
85+
86+
* The packed json version of the iana tzdb is imported from [moment-timezone](https://github.com/moment/moment-timezone) package.
87+
7588

76-
+ The author of joda time and the lead architect of the JSR-310 is Stephen Colebourne.

0 commit comments

Comments
 (0)