@attocash/cli 0.1.0

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.
Files changed (400) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +707 -0
  3. package/dist/application/app.d.ts +138 -0
  4. package/dist/application/app.js +654 -0
  5. package/dist/application/operations.d.ts +9 -0
  6. package/dist/application/operations.js +96 -0
  7. package/dist/cli/cli.d.ts +1 -0
  8. package/dist/cli/cli.js +460 -0
  9. package/dist/cli/help.d.ts +4 -0
  10. package/dist/cli/help.js +49 -0
  11. package/dist/cli/main.d.ts +2 -0
  12. package/dist/cli/main.js +13 -0
  13. package/dist/cli/onboarding.d.ts +14 -0
  14. package/dist/cli/onboarding.js +144 -0
  15. package/dist/cli/output.d.ts +2 -0
  16. package/dist/cli/output.js +231 -0
  17. package/dist/cli/terminal.d.ts +6 -0
  18. package/dist/cli/terminal.js +92 -0
  19. package/dist/cli/update-check.d.ts +1 -0
  20. package/dist/cli/update-check.js +12 -0
  21. package/dist/cli/updates.d.ts +2 -0
  22. package/dist/cli/updates.js +98 -0
  23. package/dist/core.d.ts +14 -0
  24. package/dist/core.js +14 -0
  25. package/dist/doctor/credential-probe.d.ts +7 -0
  26. package/dist/doctor/credential-probe.js +49 -0
  27. package/dist/doctor/doctor.d.ts +4 -0
  28. package/dist/doctor/doctor.js +213 -0
  29. package/dist/doctor/keyring.d.ts +7 -0
  30. package/dist/doctor/keyring.js +150 -0
  31. package/dist/doctor/profile.d.ts +19 -0
  32. package/dist/doctor/profile.js +73 -0
  33. package/dist/doctor/types.d.ts +40 -0
  34. package/dist/doctor/types.js +1 -0
  35. package/dist/domain/amount.d.ts +6 -0
  36. package/dist/domain/amount.js +27 -0
  37. package/dist/domain/errors.d.ts +10 -0
  38. package/dist/domain/errors.js +16 -0
  39. package/dist/labels/directory.d.ts +87 -0
  40. package/dist/labels/directory.js +140 -0
  41. package/dist/labels/personal.d.ts +17 -0
  42. package/dist/labels/personal.js +56 -0
  43. package/dist/labels/presentation.d.ts +154 -0
  44. package/dist/labels/presentation.js +90 -0
  45. package/dist/network/reader.d.ts +31 -0
  46. package/dist/network/reader.js +370 -0
  47. package/dist/network/retry.d.ts +7 -0
  48. package/dist/network/retry.js +53 -0
  49. package/dist/network/work.d.ts +3 -0
  50. package/dist/network/work.js +66 -0
  51. package/dist/pricing/market.d.ts +29 -0
  52. package/dist/pricing/market.js +150 -0
  53. package/dist/pricing/terms.d.ts +6 -0
  54. package/dist/pricing/terms.js +12 -0
  55. package/dist/spending/destination.d.ts +16 -0
  56. package/dist/spending/destination.js +42 -0
  57. package/dist/spending/journal.d.ts +28 -0
  58. package/dist/spending/journal.js +69 -0
  59. package/dist/spending/ledger.d.ts +118 -0
  60. package/dist/spending/ledger.js +444 -0
  61. package/dist/spending/payments.d.ts +67 -0
  62. package/dist/spending/payments.js +424 -0
  63. package/dist/spending/pool.d.ts +13 -0
  64. package/dist/spending/pool.js +38 -0
  65. package/dist/spending/reconcile.d.ts +18 -0
  66. package/dist/spending/reconcile.js +64 -0
  67. package/dist/storage/profiles.d.ts +13 -0
  68. package/dist/storage/profiles.js +86 -0
  69. package/dist/storage/secrets.d.ts +16 -0
  70. package/dist/storage/secrets.js +104 -0
  71. package/dist/storage/state.d.ts +32 -0
  72. package/dist/storage/state.js +255 -0
  73. package/dist/wallet/auto-receive.d.ts +57 -0
  74. package/dist/wallet/auto-receive.js +140 -0
  75. package/dist/wallet/defaults.d.ts +3 -0
  76. package/dist/wallet/defaults.js +26 -0
  77. package/dist/wallet/signing.d.ts +17 -0
  78. package/dist/wallet/signing.js +128 -0
  79. package/dist/wallet/types.d.ts +65 -0
  80. package/dist/wallet/types.js +1 -0
  81. package/dist/wallet/work.d.ts +29 -0
  82. package/dist/wallet/work.js +154 -0
  83. package/dist/watches/manager.d.ts +75 -0
  84. package/dist/watches/manager.js +197 -0
  85. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +6678 -0
  86. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
  87. package/node_modules/@attocash/commons-core/LICENSE +28 -0
  88. package/node_modules/@attocash/commons-core/README.md +118 -0
  89. package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +1036 -0
  90. package/node_modules/@attocash/commons-core/commons-commons-core.mjs +7701 -0
  91. package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -0
  92. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +17681 -0
  93. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -0
  94. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
  95. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
  96. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +209 -0
  97. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
  98. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +2284 -0
  99. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
  100. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +6042 -0
  101. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
  102. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  103. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  104. package/node_modules/@attocash/commons-core/package.json +27 -0
  105. package/node_modules/@attocash/commons-node/LICENSE +28 -0
  106. package/node_modules/@attocash/commons-node/README.md +92 -0
  107. package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +255 -0
  108. package/node_modules/@attocash/commons-node/commons-commons-node.mjs +2977 -0
  109. package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -0
  110. package/node_modules/@attocash/commons-node/kotlin-logging.mjs +432 -0
  111. package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -0
  112. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  113. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  114. package/node_modules/@attocash/commons-node/package.json +29 -0
  115. package/node_modules/@attocash/commons-node-remote/LICENSE +28 -0
  116. package/node_modules/@attocash/commons-node-remote/README.md +61 -0
  117. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +122 -0
  118. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +1810 -0
  119. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -0
  120. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +432 -0
  121. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -0
  122. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs +8 -0
  123. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -0
  124. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  125. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  126. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  127. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  128. package/node_modules/@attocash/commons-node-remote/package.json +31 -0
  129. package/node_modules/@attocash/commons-transport/LICENSE +28 -0
  130. package/node_modules/@attocash/commons-transport/README.md +5 -0
  131. package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +64 -0
  132. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +249 -0
  133. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -0
  134. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +263 -0
  135. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -0
  136. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs +8 -0
  137. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -0
  138. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +11604 -0
  139. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -0
  140. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  141. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  142. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  143. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  144. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +499 -0
  145. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -0
  146. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +6456 -0
  147. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -0
  148. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +83 -0
  149. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -0
  150. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +1714 -0
  151. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -0
  152. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +3197 -0
  153. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -0
  154. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +2290 -0
  155. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -0
  156. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +46 -0
  157. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
  158. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +482 -0
  159. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
  160. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +165 -0
  161. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -0
  162. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs +4 -0
  163. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -0
  164. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +3222 -0
  165. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -0
  166. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs +4 -0
  167. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -0
  168. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +1485 -0
  169. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -0
  170. package/node_modules/@attocash/commons-transport/package.json +29 -0
  171. package/node_modules/@attocash/commons-worker/LICENSE +28 -0
  172. package/node_modules/@attocash/commons-worker/README.md +48 -0
  173. package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +73 -0
  174. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +702 -0
  175. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -0
  176. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +432 -0
  177. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -0
  178. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  179. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  180. package/node_modules/@attocash/commons-worker/package.json +29 -0
  181. package/node_modules/@attocash/commons-worker-remote/LICENSE +28 -0
  182. package/node_modules/@attocash/commons-worker-remote/README.md +60 -0
  183. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +93 -0
  184. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +289 -0
  185. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -0
  186. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +432 -0
  187. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -0
  188. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs +8 -0
  189. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -0
  190. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  191. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  192. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  193. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  194. package/node_modules/@attocash/commons-worker-remote/package.json +31 -0
  195. package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
  196. package/node_modules/@js-joda/core/CheatSheet.md +947 -0
  197. package/node_modules/@js-joda/core/LICENSE +34 -0
  198. package/node_modules/@js-joda/core/README.md +155 -0
  199. package/node_modules/@js-joda/core/bower.json +21 -0
  200. package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
  201. package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
  202. package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
  203. package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
  204. package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
  205. package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
  206. package/node_modules/@js-joda/core/package.json +76 -0
  207. package/node_modules/@js-joda/core/src/Clock.js +330 -0
  208. package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
  209. package/node_modules/@js-joda/core/src/Duration.js +1205 -0
  210. package/node_modules/@js-joda/core/src/Enum.js +30 -0
  211. package/node_modules/@js-joda/core/src/Instant.js +1012 -0
  212. package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
  213. package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
  214. package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
  215. package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
  216. package/node_modules/@js-joda/core/src/Month.js +600 -0
  217. package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
  218. package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
  219. package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
  220. package/node_modules/@js-joda/core/src/Period.js +933 -0
  221. package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
  222. package/node_modules/@js-joda/core/src/Year.js +1015 -0
  223. package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
  224. package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
  225. package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
  226. package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
  227. package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
  228. package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
  229. package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
  230. package/node_modules/@js-joda/core/src/_init.js +68 -0
  231. package/node_modules/@js-joda/core/src/assert.js +33 -0
  232. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
  233. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
  234. package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
  235. package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
  236. package/node_modules/@js-joda/core/src/convert.js +83 -0
  237. package/node_modules/@js-joda/core/src/errors.js +54 -0
  238. package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
  239. package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
  240. package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
  241. package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
  242. package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
  243. package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
  244. package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
  245. package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
  246. package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
  247. package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
  248. package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
  249. package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
  250. package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
  251. package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
  252. package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
  253. package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
  254. package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
  255. package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
  256. package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
  257. package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
  258. package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
  259. package/node_modules/@js-joda/core/src/js-joda.js +210 -0
  260. package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
  261. package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
  262. package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
  263. package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
  264. package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
  265. package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
  266. package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
  267. package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
  268. package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
  269. package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
  270. package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
  271. package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
  272. package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
  273. package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
  274. package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
  275. package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
  276. package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
  277. package/node_modules/@js-joda/core/src/use.js +20 -0
  278. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
  279. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
  280. package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
  281. package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
  282. package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
  283. package/node_modules/@noble/hashes/LICENSE +21 -0
  284. package/node_modules/@noble/hashes/README.md +563 -0
  285. package/node_modules/@noble/hashes/_blake.d.ts +21 -0
  286. package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
  287. package/node_modules/@noble/hashes/_blake.js +52 -0
  288. package/node_modules/@noble/hashes/_blake.js.map +1 -0
  289. package/node_modules/@noble/hashes/_md.d.ts +99 -0
  290. package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
  291. package/node_modules/@noble/hashes/_md.js +202 -0
  292. package/node_modules/@noble/hashes/_md.js.map +1 -0
  293. package/node_modules/@noble/hashes/_u64.d.ts +63 -0
  294. package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
  295. package/node_modules/@noble/hashes/_u64.js +84 -0
  296. package/node_modules/@noble/hashes/_u64.js.map +1 -0
  297. package/node_modules/@noble/hashes/argon2.d.ts +112 -0
  298. package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
  299. package/node_modules/@noble/hashes/argon2.js +517 -0
  300. package/node_modules/@noble/hashes/argon2.js.map +1 -0
  301. package/node_modules/@noble/hashes/blake1.d.ts +156 -0
  302. package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
  303. package/node_modules/@noble/hashes/blake1.js +560 -0
  304. package/node_modules/@noble/hashes/blake1.js.map +1 -0
  305. package/node_modules/@noble/hashes/blake2.d.ts +184 -0
  306. package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
  307. package/node_modules/@noble/hashes/blake2.js +501 -0
  308. package/node_modules/@noble/hashes/blake2.js.map +1 -0
  309. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  310. package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
  311. package/node_modules/@noble/hashes/blake3.js +284 -0
  312. package/node_modules/@noble/hashes/blake3.js.map +1 -0
  313. package/node_modules/@noble/hashes/eskdf.d.ts +92 -0
  314. package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
  315. package/node_modules/@noble/hashes/eskdf.js +218 -0
  316. package/node_modules/@noble/hashes/eskdf.js.map +1 -0
  317. package/node_modules/@noble/hashes/hkdf.d.ts +64 -0
  318. package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
  319. package/node_modules/@noble/hashes/hkdf.js +120 -0
  320. package/node_modules/@noble/hashes/hkdf.js.map +1 -0
  321. package/node_modules/@noble/hashes/hmac.d.ts +47 -0
  322. package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
  323. package/node_modules/@noble/hashes/hmac.js +93 -0
  324. package/node_modules/@noble/hashes/hmac.js.map +1 -0
  325. package/node_modules/@noble/hashes/index.d.ts +2 -0
  326. package/node_modules/@noble/hashes/index.d.ts.map +1 -0
  327. package/node_modules/@noble/hashes/index.js +35 -0
  328. package/node_modules/@noble/hashes/index.js.map +1 -0
  329. package/node_modules/@noble/hashes/legacy.d.ts +102 -0
  330. package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
  331. package/node_modules/@noble/hashes/legacy.js +327 -0
  332. package/node_modules/@noble/hashes/legacy.js.map +1 -0
  333. package/node_modules/@noble/hashes/package.json +97 -0
  334. package/node_modules/@noble/hashes/pbkdf2.d.ts +56 -0
  335. package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
  336. package/node_modules/@noble/hashes/pbkdf2.js +135 -0
  337. package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
  338. package/node_modules/@noble/hashes/scrypt.d.ts +65 -0
  339. package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
  340. package/node_modules/@noble/hashes/scrypt.js +257 -0
  341. package/node_modules/@noble/hashes/scrypt.js.map +1 -0
  342. package/node_modules/@noble/hashes/sha2.d.ts +249 -0
  343. package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
  344. package/node_modules/@noble/hashes/sha2.js +458 -0
  345. package/node_modules/@noble/hashes/sha2.js.map +1 -0
  346. package/node_modules/@noble/hashes/sha3-addons.d.ts +461 -0
  347. package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
  348. package/node_modules/@noble/hashes/sha3-addons.js +783 -0
  349. package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
  350. package/node_modules/@noble/hashes/sha3.d.ts +199 -0
  351. package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
  352. package/node_modules/@noble/hashes/sha3.js +431 -0
  353. package/node_modules/@noble/hashes/sha3.js.map +1 -0
  354. package/node_modules/@noble/hashes/src/_blake.ts +57 -0
  355. package/node_modules/@noble/hashes/src/_md.ts +222 -0
  356. package/node_modules/@noble/hashes/src/_u64.ts +117 -0
  357. package/node_modules/@noble/hashes/src/argon2.ts +667 -0
  358. package/node_modules/@noble/hashes/src/blake1.ts +614 -0
  359. package/node_modules/@noble/hashes/src/blake2.ts +582 -0
  360. package/node_modules/@noble/hashes/src/blake3.ts +317 -0
  361. package/node_modules/@noble/hashes/src/eskdf.ts +259 -0
  362. package/node_modules/@noble/hashes/src/hkdf.ts +133 -0
  363. package/node_modules/@noble/hashes/src/hmac.ts +126 -0
  364. package/node_modules/@noble/hashes/src/index.ts +33 -0
  365. package/node_modules/@noble/hashes/src/legacy.ts +339 -0
  366. package/node_modules/@noble/hashes/src/pbkdf2.ts +175 -0
  367. package/node_modules/@noble/hashes/src/scrypt.ts +315 -0
  368. package/node_modules/@noble/hashes/src/sha2.ts +530 -0
  369. package/node_modules/@noble/hashes/src/sha3-addons.ts +983 -0
  370. package/node_modules/@noble/hashes/src/sha3.ts +485 -0
  371. package/node_modules/@noble/hashes/src/utils.ts +848 -0
  372. package/node_modules/@noble/hashes/src/webcrypto.ts +239 -0
  373. package/node_modules/@noble/hashes/utils.d.ts +519 -0
  374. package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
  375. package/node_modules/@noble/hashes/utils.js +578 -0
  376. package/node_modules/@noble/hashes/utils.js.map +1 -0
  377. package/node_modules/@noble/hashes/webcrypto.d.ts +120 -0
  378. package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
  379. package/node_modules/@noble/hashes/webcrypto.js +165 -0
  380. package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
  381. package/node_modules/ws/LICENSE +20 -0
  382. package/node_modules/ws/README.md +548 -0
  383. package/node_modules/ws/browser.js +8 -0
  384. package/node_modules/ws/index.js +22 -0
  385. package/node_modules/ws/lib/buffer-util.js +131 -0
  386. package/node_modules/ws/lib/constants.js +19 -0
  387. package/node_modules/ws/lib/event-target.js +292 -0
  388. package/node_modules/ws/lib/extension.js +203 -0
  389. package/node_modules/ws/lib/limiter.js +55 -0
  390. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  391. package/node_modules/ws/lib/receiver.js +743 -0
  392. package/node_modules/ws/lib/sender.js +607 -0
  393. package/node_modules/ws/lib/stream.js +161 -0
  394. package/node_modules/ws/lib/subprotocol.js +62 -0
  395. package/node_modules/ws/lib/validation.js +152 -0
  396. package/node_modules/ws/lib/websocket-server.js +562 -0
  397. package/node_modules/ws/lib/websocket.js +1407 -0
  398. package/node_modules/ws/package.json +74 -0
  399. package/node_modules/ws/wrapper.mjs +21 -0
  400. package/package.json +53 -0
@@ -0,0 +1,947 @@
1
+ # js-joda cheat sheet
2
+
3
+ For a detailed API Reference refer to the [ESDoc generated docs](./esdoc/).
4
+
5
+ ## Table of contents
6
+
7
+ <!-- toc -->
8
+
9
+ - [General concepts](#general-concepts)
10
+ * [Method naming conventions](#method-naming-conventions)
11
+ - [LocalDate](#localdate)
12
+ * [Create a `LocalDate`](#create-a-localdate)
13
+ * [Get values from `LocalDate`](#get-values-from-localdate)
14
+ * [Get week of week-based year, quarter of year, day of quarter](#get-week-of-week-based-year-quarter-of-year-day-of-quarter)
15
+ * [Adding to and subtracting from a `LocalDate`](#adding-to-and-subtracting-from-a-localdate)
16
+ * [Alter specific fields of a LocalDate](#alter-specific-fields-of-a-localdate)
17
+ * [Compare one `LocalDate` with another](#compare-one-localdate-with-another)
18
+ * [Distance on the timeline](#distance-on-the-timeline)
19
+ * [Converting from and to other temporals](#converting-from-and-to-other-temporals)
20
+ * [Adjust a date to another date](#adjust-a-date-to-another-date)
21
+ - [LocalTime](#localtime)
22
+ * [Create a `LocalTime` instance](#create-a-localtime-instance)
23
+ * [Get values from `LocalTime`](#get-values-from-localtime)
24
+ * [Adding to/ subtracting from a `LocalTime` instance](#adding-to-subtracting-from-a-localtime-instance)
25
+ * [Alter specific fields of a `LocalTime` instance](#alter-specific-fields-of-a-localtime-instance)
26
+ * [Truncate a `LocalTime` instance](#truncate-a-localtime-instance)
27
+ * [Compare `LocalTime` instances](#compare-localtime-instances)
28
+ * [Distance between times](#distance-between-times)
29
+ * [Convert a `LocalTime` from a `moment` or JavaScript `Date`](#convert-a-localtime-from-a-moment-or-javascript-date)
30
+ - [LocalDateTime](#localdatetime)
31
+ * [Create a `LocalDateTime` instance](#create-a-localdatetime-instance)
32
+ * [Get values from `LocalDateTime`](#get-values-from-localdatetime)
33
+ * [Adding to and subtracting from a `LocalDateTime` instance](#adding-to-and-subtracting-from-a-localdatetime-instance)
34
+ * [Alter specific fields of a `LocalDateTime` instance](#alter-specific-fields-of-a-localdatetime-instance)
35
+ * [Truncate a `LocalDateTime` instance](#truncate-a-localdatetime-instance)
36
+ * [Compare `LocalDateTime` instances](#compare-localdatetime-instances)
37
+ * [Distance between two `LocalDateTime` instances](#distance-between-two-localdatetime-instances)
38
+ * [Convert from a `moment` or JavaScript `Date`](#convert-from-a-moment-or-javascript-date)
39
+ - [ZonedDateTime](#zoneddatetime)
40
+ * [The `SYSTEM` zone ID](#the-system-zone-id)
41
+ * [Working with time zones](#working-with-time-zones)
42
+ * [Create a ZonedDateTime](#create-a-zoneddatetime)
43
+ * [Switch time zones](#switch-time-zones)
44
+ * [Get and manipulate values from a `ZonedDateTime`](#get-and-manipulate-values-from-a-zoneddatetime)
45
+ * [Calculate values across daylight savings transitions](#calculate-values-across-daylight-savings-transitions)
46
+ - [Period](#period)
47
+ - [Duration](#duration)
48
+ - [Customizing js-joda](#customizing-js-joda)
49
+ * [Custom temporal adjuster](#custom-temporal-adjuster)
50
+ * [Custom temporal fields and temporal units](#custom-temporal-fields-and-temporal-units)
51
+ * [Custom formatter and queries](#custom-formatter-and-queries)
52
+
53
+ <!-- tocstop -->
54
+
55
+ ---
56
+
57
+ ## General concepts
58
+
59
+ The API is **immutable**. An existing instance is never changed. All manipulating methods (`plus`, `at`, etc.) return new instances.
60
+
61
+ **An existing instance is always valid**. If you try to create an invalid value, you'll get an exception instead of a `null` or `undefined` value.
62
+
63
+ ### Method naming conventions
64
+
65
+ The API uses consistently named methods.
66
+
67
+ | method name or prefix | usage | examples |
68
+ | --------------------- | -------------------------------------------- | --------------------------------------------------------------- |
69
+ | `.of` | static factory method for building by parts | `LocalDate.of(2016, 2, 23)` <br> `LocalDate.ofInstant(i)` |
70
+ | `.parse` | static factory method for parsing strings | `LocalDate.parse('2016-02-23')` <br> `LocalTime.parse('12:34')` |
71
+ | `.is` | checks for certain conditions | `t1.isAfter(t2)` <br> `d1.isLeapYear()` |
72
+ | `.equals` | checks for equivalence between two instances | `t1.equals(t2)` |
73
+ | `.with` | the immutable equivalent of a setter | `d.withDayOfMonth(1)` <br> `t.withHour(9)` |
74
+ | `.plus` | adds an amount to an object | `t.plusMinutes(5)` <br> `d.plus(3, ChronoUnit.YEARS)` |
75
+ | `.minus` | subtracts an amount from an object | `t.minusHours(1)` <br> `d.minus(1, ChronoUnit.DAYS)` |
76
+ | `.to` | converts this object to another type | `dt.toLocalDate()` <br> `d1.until(d2).toTotalMonths()` |
77
+ | `.at` | combines one object with another | `date.atTime(time)` <br> `localDate.atZone(tz)` |
78
+
79
+ Note that getter methods for instance properties omit the get keyword: `d.year()`, not ~~`d.getYear()`~~.
80
+
81
+ ## LocalDate
82
+
83
+ A `LocalDate` represents a date with **no time** and **no time zone** in the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar system, such as 2007-12-24.
84
+
85
+ ### Create a `LocalDate`
86
+
87
+ ```javascript
88
+ // obtain the current date in the system default time zone, e.g. 2016-02-23
89
+ LocalDate.now();
90
+
91
+ // obtain the current date in the UTC time zone, e.g. 2016-02-23
92
+ LocalDate.now(ZoneOffset.UTC);
93
+
94
+ // obtain an instance of LocalDate from an ISO 8601 formatted text string
95
+ LocalDate.parse('2016-02-23');
96
+
97
+ // obtain an instance of LocalDate from a year, month, and dayOfMonth value
98
+ LocalDate.of(2016, 2, 23); // 2016-02-23
99
+
100
+ // obtain an instance of LocalDate from a year, month, and dayOfMonth value
101
+ LocalDate.of(2016, Month.FEBRUARY, 23); // 2016-02-23
102
+
103
+ // obtain an instance of LocalDate from an epochDay where day 0 is 1970-01-01
104
+ LocalDate.ofEpochDay(-1); // 1969-12-31
105
+
106
+ // obtain an instance of LocalDate from an epochDay where day 0 is 1970-01-01
107
+ LocalDate.ofYearDay(2016, 42); // 2016-02-11
108
+ ```
109
+
110
+ ### Get values from `LocalDate`
111
+
112
+ ```javascript
113
+ var d = LocalDate.parse('2016-12-24');
114
+
115
+ d.toString(); // '2016-12-24' ISO 8601 format
116
+
117
+ d.dayOfMonth(); // 24
118
+ d.month(); // Month.DECEMBER
119
+ d.monthValue(); // 12
120
+ d.year(); // 2016
121
+
122
+ d.dayOfWeek(); // DayOfWeek.SATURDAY
123
+ d.dayOfWeek().value(); // 6
124
+ d.dayOfYear(); // 359
125
+
126
+ d.isLeapYear(); // true - 2016 is a leap year
127
+ d.plusYears(1).isLeapYear(); // false
128
+
129
+ // get the epoch day where 0 is 1970-01-01
130
+ d.toEpochDay(); // 17159
131
+
132
+ // get range of month
133
+ d.lengthOfMonth(); // 31
134
+ d.range(ChronoField.DAY_OF_MONTH); // ValueRange(1 - 31)
135
+
136
+ // get range of year
137
+ d.lengthOfYear(); // 366
138
+ d.range(ChronoField.DAY_OF_YEAR); // ValueRange(1 - 366)
139
+
140
+ // get other date-based field like the aligned week of year
141
+ d.get(ChronoField.ALIGNED_WEEK_OF_YEAR); // 52
142
+
143
+ // or the day of week aligned to the first day of month
144
+ d.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH); // 3
145
+ ```
146
+
147
+ ### Get week of week-based year, quarter of year, day of quarter
148
+
149
+ ```javascript
150
+ // get week of week-based year as defined by ISO 8601, with a Monday-based week
151
+ d.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); // 51
152
+
153
+ d.isoWeekOfWeekyear(); // 51, equivalent to the above
154
+ d.isoWeekyear(); // 2016
155
+
156
+ LocalDate.of(2017, 1, 1).isoWeekOfWeekyear(); // 52
157
+ LocalDate.of(2017, 1, 1).isoWeekyear(); // 2016
158
+
159
+ // set the date to week 52 of week-based year with the same day of week
160
+ d.with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 52); // 2016-12-31
161
+
162
+ // get the quarter of the year
163
+ d.get(IsoFields.QUARTER_OF_YEAR); // 4
164
+ d.get(IsoFields.DAY_OF_QUARTER); // 85
165
+
166
+ // set the date to the 15th day of the third quarter
167
+ d.with(IsoFields.QUARTER_OF_YEAR, 3).with(IsoFields.DAY_OF_QUARTER, 15); // 2016-07-15
168
+ ```
169
+
170
+ ### Adding to and subtracting from a `LocalDate`
171
+
172
+ Note that each of these methods returns a new `LocalDate` instance.
173
+
174
+ ```javascript
175
+ var d = LocalDate.parse('2016-02-23');
176
+
177
+ // add/subtract 366 days
178
+ d.plusDays(366); // '2017-02-23'
179
+ d.minusDays(366); // '2015-02-22'
180
+
181
+ // add/subtract 12 months
182
+ d.plusMonths(12); // '2017-02-23'
183
+ d.minusMonths(12); // '2015-02-23'
184
+
185
+ // add/subtract 4 weeks
186
+ d.plusWeeks(4); // '2016-03-22'
187
+ d.minusWeeks(4); // '2016-01-26'
188
+
189
+ // add/subtract 1 year
190
+ d.plusYears(1); // '2017-02-23'
191
+ d.minusYears(1); // '2015-02-23'
192
+
193
+ // add/subtract 30 years
194
+ d.plus(3, ChronoUnit.DECADES); // '2046-02-23'
195
+ d.minus(3, ChronoUnit.DECADES); // '1986-02-23'
196
+
197
+ // add/subtract a Period of 3 Months and 3 Days
198
+ d.plus(Period.ofMonths(3).plusDays(3)); // '2016-05-26'
199
+ d.minus(Period.ofMonths(3).plusDays(3)); // '2015-11-20'
200
+ ```
201
+
202
+ ### Alter specific fields of a LocalDate
203
+
204
+ ```javascript
205
+ var d = LocalDate.parse('2016-12-24');
206
+
207
+ // set the day of month to 1
208
+ d.withDayOfMonth(1); // '2016-12-01'
209
+
210
+ // set month and the day of month to 1
211
+ d.withMonth(1).withDayOfMonth(1); // '2016-01-01'
212
+
213
+ // set month to November and the day of month to 1
214
+ d.withMonth(Month.NOVEMBER).withDayOfMonth(1); // '2016-11-01'
215
+
216
+ // set the year to beginning of era
217
+ d.withYear(1); // '0001-12-24'
218
+
219
+ // get the last day of the current month
220
+ LocalDate.now()
221
+ .plusMonths(1)
222
+ .withDayOfMonth(1)
223
+ .minusDays(1);
224
+
225
+ // set the day of year
226
+ d.withDayOfYear(42); // 2016-02-11
227
+
228
+ // set the week of week-based year to 52
229
+ d.with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 52); // 2016-12-31
230
+ ```
231
+
232
+ ### Compare one `LocalDate` with another
233
+
234
+ ```javascript
235
+ var d1 = LocalDate.parse('2016-12-24');
236
+ var d2 = d1.plusDays(2);
237
+
238
+ d1.isAfter(d2); // false
239
+ d1.isBefore(d2); // true
240
+
241
+ d1.equals(d2); // false
242
+ d1.equals(d1.plusDays(0)); // true
243
+ d1.equals(d1.plusDays(1)); // false
244
+
245
+ d1.compareTo(d1) === 0; // true
246
+ d1.compareTo(d2) < 0; // true
247
+ d2.compareTo(d1) > 0; // true
248
+
249
+ d1.hashCode(); // 4129560
250
+ d2.hashCode(); // 4129562
251
+ d1.hashCode() !== d2.hashCode(); // true
252
+ ```
253
+
254
+ ### Distance on the timeline
255
+
256
+ ```javascript
257
+ var d1 = LocalDate.parse('2016-12-24');
258
+ var d2 = d1.plusMonths(13).plusDays(42);
259
+
260
+ // obtain the Period between the two dates
261
+ d1.until(d2).toString(); // 'P1Y2M11D' (1 year, 2 months, 11 days in ISO-8601 period format)
262
+ d1.until(d2).toTotalMonths(); // 14
263
+
264
+ // obtain the distance between the two dates with a specific precision
265
+ d1.until(d2, ChronoUnit.MONTHS); // 14, returns the distance in total months
266
+ d1.until(d2, ChronoUnit.DAYS); // 438, returns the distance in total days
267
+ ```
268
+
269
+ ### Converting from and to other temporals
270
+
271
+ ```javascript
272
+ // obtain a LocalDate from a LocalDateTime instance
273
+ var dt = LocalDateTime.now();
274
+ LocalDate.from(dt); // LocalDate from LocalDateTime
275
+ dt.toLocalDate(); // LocalDateTime to LocalDate (equivalent to the above)
276
+
277
+ var d1 = LocalDate.parse('2016-02-25');
278
+
279
+ // obtain a LocalDateTime at a certain LocalTime
280
+ d1.atStartOfDay(); // '2016-02-25T00:00'
281
+ d1.atTime(LocalTime.of(11, 55)); // '2016-02-25T11:55'
282
+ d1.atTime(LocalTime.NOON); // '2016-02-25T12:00'
283
+
284
+ // obtain a LocalDate from a JavaScript Date
285
+
286
+ // the manual way
287
+ var d = LocalDate.ofInstant(Instant.ofEpochMilli(new Date().getTime()));
288
+ // the recommended way with the JavaScript temporal
289
+ d = LocalDate.from(nativeJs(new Date()));
290
+ // converting from a moment works the same way
291
+ d = LocalDate.from(nativeJs(moment()));
292
+ ```
293
+
294
+ ### Adjust a date to another date
295
+
296
+ `TemporalAdjusters` provide compact business logic for date-based temporals such as `LocalDate`, `LocalDateTime` or `ZonedDateTime`.
297
+
298
+ ```javascript
299
+ var d = LocalDate.parse('2016-12-24');
300
+
301
+ // get first/ last day of month
302
+ d.with(TemporalAdjusters.firstDayOfMonth()); // 2016-12-01
303
+ d.with(TemporalAdjusters.lastDayOfMonth()); // 2016-12-31
304
+
305
+ // get the next specified weekday
306
+ d.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 2016-12-25
307
+ d.with(TemporalAdjusters.nextOrSame(DayOfWeek.SATURDAY)); // 2016-12-24
308
+ d.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)); // 2016-12-31
309
+
310
+ // get the first/last weekday of month
311
+ d.with(TemporalAdjusters.lastInMonth(DayOfWeek.SATURDAY)); // 2016-12-31
312
+ d.with(TemporalAdjusters.firstInMonth(DayOfWeek.SATURDAY)); // 2016-12-03
313
+ ```
314
+
315
+ Find more adjusters in the TemporalAdjusters API documentation.
316
+
317
+ ## LocalTime
318
+
319
+ A `LocalTime` represents a time with **no date** and **no time zone** in the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar system, such as '10:15:30'
320
+
321
+ ### Create a `LocalTime` instance
322
+
323
+ ```javascript
324
+ // obtain the current time in the system default time zone, e.g. '10:29:05.743'
325
+ LocalTime.now();
326
+
327
+ // obtain the current time in the UTC time zone, e.g. '09:29:05.743'
328
+ LocalTime.now(ZoneOffset.UTC);
329
+
330
+ // obtain an instance of LocalTime from an ISO 8601 formatted text string
331
+ LocalTime.parse('09:42'); // '09:42'
332
+ LocalTime.parse('09:42:42'); // '09:42:42'
333
+ LocalTime.parse('09:42:42.123'); // '09:42:42.123'
334
+ LocalTime.parse('09:42:42.123456789'); // '09:42:42.123456789'
335
+
336
+ // obtain an instance of LocalTime from hour, minute, second, and nanosecond values
337
+ LocalTime.of(23, 55); // '23:55'
338
+ LocalTime.of(23, 55, 42); // '23:55:42'
339
+ LocalTime.of(23, 55, 42, 123000000); // '23:55:42.123'
340
+
341
+ // obtain an instance of LocalTime from second of day
342
+ LocalTime.ofSecondOfDay(3666); // '01:01:06'
343
+ ```
344
+
345
+ ### Get values from `LocalTime`
346
+
347
+ ```javascript
348
+ var t = LocalTime.parse('23:55:42.123');
349
+
350
+ t.toString(); // '23:55:42.123' ISO 8601 format
351
+
352
+ t.hour(); // 23
353
+ t.minute(); // 55
354
+ t.second(); // 42
355
+ t.nano(); // 123000000
356
+
357
+ // get other time-based fields
358
+ t.get(ChronoField.SECOND_OF_DAY); // 86142
359
+ t.get(ChronoField.MILLI_OF_SECOND); // 123
360
+ t.get(ChronoField.HOUR_OF_AMPM); // 11
361
+ // any other time-based ChronoField is allowed as param for get
362
+ ```
363
+
364
+ ### Adding to/ subtracting from a `LocalTime` instance
365
+
366
+ ```javascript
367
+ var t = LocalTime.parse('11:55:42');
368
+
369
+ // add/subtract 12 hours
370
+ t.plusHours(12); // '23:55:42'
371
+ t.minusHours(12); // '23:55:42'
372
+
373
+ // add/subtract 30 minutes
374
+ t.plusMinutes(30); // '12:25:42'
375
+ t.minusMinutes(30); // '11:25:42'
376
+
377
+ // add/subtract 30 seconds
378
+ t.plusSeconds(30); // '11:56:12'
379
+ t.minusSeconds(30); // '11:55:12'
380
+
381
+ // add/subtract 1 million nanoseconds (1 millisecond)
382
+ t.plusNanos(1000000); // '11:56:42.001'
383
+ t.minusNanos(1000000); // '11:55:41.999'
384
+
385
+ // add/subtract a time-based unit
386
+ t.plus(1, ChronoUnit.MILLIS); // '11:55:42.001'
387
+ t.plus(1, ChronoUnit.HALF_DAYS); // '23:55:42'
388
+
389
+ // add/subtract a duration of 15 minutes
390
+ t.plus(Duration.ofMinutes(15)); // '12:10:42'
391
+ t.minus(Duration.ofMinutes(15)); // '11:40:42'
392
+ ```
393
+
394
+ ### Alter specific fields of a `LocalTime` instance
395
+
396
+ ```javascript
397
+ var t = LocalTime.parse('11:55:42');
398
+
399
+ // set the hour of day to 1
400
+ t.withHour(1); // '01:55:42'
401
+
402
+ // set the minute of hour to 1
403
+ t.withMinute(1); // '11:01:42'
404
+
405
+ // set the second of minute to 1
406
+ t.withSecond(1); // '11:55:01'
407
+
408
+ // set the MILLI_OF_SECOND to 51
409
+ t.with(ChronoField.MILLI_OF_SECOND, 51); // '11:55:42.051'
410
+
411
+ // set by a custom TemporalAdjusters
412
+ // sample of a custom adjuster that adjust to the next even second
413
+ nextEvenSecond = {
414
+ adjustInto: function(t) {
415
+ return t.second() % 2 === 0 ? t.plusSeconds(2) : t.plusSeconds(1);
416
+ },
417
+ };
418
+ t.with(nextEvenSecond); // '11:55:44'
419
+ t.plusSeconds(1).with(nextEvenSecond); // '11:55:44'
420
+ ```
421
+
422
+ ### Truncate a `LocalTime` instance
423
+
424
+ ```javascript
425
+ var t = LocalTime.parse('23:55:42.123');
426
+
427
+ t.truncatedTo(ChronoUnit.SECONDS); // '23:55:42'
428
+ t.truncatedTo(ChronoUnit.MINUTES); // '23:55:00'
429
+ t.truncatedTo(ChronoUnit.HOURS); // '23:00'
430
+ t.truncatedTo(ChronoUnit.HALF_DAYS); // '12:00'
431
+ t.truncatedTo(ChronoUnit.DAYS); // '00:00'
432
+ ```
433
+
434
+ ### Compare `LocalTime` instances
435
+
436
+ ```javascript
437
+ var t1 = LocalTime.parse('11:55:42');
438
+ var t2 = t1.plusHours(2);
439
+
440
+ t1.isAfter(t2); // false
441
+ t1.isBefore(t2); // true
442
+
443
+ t1.equals(t1.plusHours(0)); // true
444
+ t1.equals(t1.plusHours(1)); // false
445
+
446
+ t1.compareTo(t1) === 0; // true
447
+ t1.compareTo(t2) < 0; // true
448
+ t2.compareTo(t1) > 0; // true
449
+
450
+ t1.hashCode(); // 916974646
451
+ t2.hashCode(); // -1743180648
452
+ t1.hashCode() !== t2.hashCode(); // true
453
+ ```
454
+
455
+ ### Distance between times
456
+
457
+ ```javascript
458
+ var t1 = LocalTime.parse('11:00');
459
+ var t2 = t1
460
+ .plusHours(2)
461
+ .plusMinutes(42)
462
+ .plusSeconds(12);
463
+
464
+ // obtain the duration between the two dates
465
+ t1.until(t2, ChronoUnit.HOURS); // 2
466
+ t1.until(t2, ChronoUnit.MINUTES); // 162
467
+ t1.until(t2, ChronoUnit.SECONDS); // 9732
468
+ ```
469
+
470
+ ### Convert a `LocalTime` from a `moment` or JavaScript `Date`
471
+
472
+ ```javascript
473
+ // obtain a LocalTime instance from a JavaScript Date
474
+
475
+ // the manual way
476
+ var t = LocalTime.ofInstant(Instant.ofEpochMilli(new Date().getTime()));
477
+ // the recommended way with the JavaScript temporal
478
+ t = LocalTime.from(nativeJs(new Date()));
479
+ // converting from a `moment` instance works the same way
480
+ d = LocalTime.from(nativeJs(moment()));
481
+ ```
482
+
483
+ ## LocalDateTime
484
+
485
+ A LocalDateTime represents a date-time with **no time zone** in the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar system, such as '2007-12-03T10:15:30'.
486
+
487
+ ### Create a `LocalDateTime` instance
488
+
489
+ ```javascript
490
+ // obtain the current date and time in the system default time zone, e.g. '2016-02-26T10:29:05.743'
491
+ LocalDateTime.now();
492
+
493
+ // obtain the current date and time in the UTC time zone
494
+ LocalDateTime.now(ZoneOffset.UTC);
495
+
496
+ // obtain an instance of LocalDateTime from an ISO 8601 formatted text string
497
+ LocalDateTime.parse('2016-02-26T09:42'); // '2016-02-26T09:42'
498
+ LocalDateTime.parse('2016-02-26T09:42:42.123'); // '2016-02-26T09:42:42.123'
499
+
500
+ // obtain an instance of LocalDateTime from year, month, dayOfMonth, hour, minute, second and nanosecond values
501
+ LocalDateTime.of(2016, 2, 29); // '2016-02-29T00:00'
502
+ LocalDateTime.of(2016, 2, 29, 12, 55, 42); // '2016-02-29T12:55:42'
503
+ LocalDateTime.of(2016, 2, 29, 12, 55, 42, 9); // '2016-02-29T12:55:42.000000009'
504
+
505
+ // obtain an instance of LocalDateTime from epoch seconds and a ZoneOffset
506
+ LocalDateTime.ofEpochSecond(0, ZoneOffset.UTC); // '1970-01-01T00:00'
507
+ LocalDateTime.ofInstant(Instant.now()); // current local date-time
508
+ LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC); // current local UTC date-time
509
+ ```
510
+
511
+ ### Get values from `LocalDateTime`
512
+
513
+ ```javascript
514
+ var dt = LocalDateTime.parse('2016-02-26T23:55:42.123');
515
+
516
+ dt.toString(); // '2016-02-26T23:55:42.123' ISO 8601 format
517
+
518
+ dt.year(); // 2016
519
+ dt.month(); // Month.FEBRUARY
520
+ dt.monthValue(); // 2
521
+ dt.dayOfMonth(); // 26
522
+ dt.hour(); // 23
523
+ dt.minute(); // 55
524
+ dt.second(); // 42
525
+ dt.nano(); // 123000000
526
+
527
+ dt.dayOfWeek(); // DayOfWeek.FRIDAY
528
+ dt.dayOfWeek().value(); // 5
529
+ dt.dayOfYear(); // 57
530
+
531
+ dt.toLocalDate().isLeapYear(); // true 2016 is a leap year
532
+
533
+ // obtain the date and time components of the LocalDateTime
534
+ dt.toLocalDate();
535
+ dt.toLocalTime();
536
+
537
+ // get range of month
538
+ dt.toLocalDate().lengthOfMonth(); // 29
539
+ dt.range(ChronoField.DAY_OF_MONTH); // ValueRange(1 - 29)
540
+
541
+ // get range of year
542
+ dt.toLocalDate().lengthOfYear(); // 366
543
+ dt.range(ChronoField.DAY_OF_YEAR); // ValueRange(1 - 366)
544
+
545
+ // get other date-based fields like the aligned week of year
546
+ dt.get(ChronoField.ALIGNED_WEEK_OF_YEAR); // 9
547
+
548
+ // get week of week-based year
549
+ dt.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); // 8
550
+ dt.toLocalDate().isoWeekOfWeekyear();
551
+
552
+ // get other time-based fields
553
+ dt.get(ChronoField.SECOND_OF_DAY); // 86142
554
+ dt.get(ChronoField.MILLI_OF_SECOND); // 123
555
+ dt.get(ChronoField.HOUR_OF_AMPM); // 11
556
+ // any other date or time-based ChronoField can be passed to `get`
557
+ ```
558
+
559
+ ### Adding to and subtracting from a `LocalDateTime` instance
560
+
561
+ ```javascript
562
+ var dt = LocalDateTime.parse('2016-02-26T23:55:42.123');
563
+
564
+ // add/subtract 366 days
565
+ dt.plusDays(366); // '2017-02-26T23:55:42.123'
566
+ dt.minusDays(366); // '2015-02-25T23:55:42.123'
567
+
568
+ // add/subtract 12 months
569
+ dt.plusMonths(12); // '2017-02-26'
570
+ dt.minusMonths(12); // '2015-02-26'
571
+
572
+ // add/subtract 4 weeks
573
+ dt.plusWeeks(4); // '2016-03-25T23:55:42.123'
574
+ dt.minusWeeks(4); // '2016-01-29T23:55:42.123'
575
+
576
+ // add/subtract 1 year to the parsed LocalDate and returns a new instance
577
+ dt.plusYears(1); // '2017-02-26T23:55:42.123'
578
+ dt.minusYears(1); // '2015-02-26T23:55:42.123'
579
+
580
+ // add/subtract 30 years
581
+ dt.plus(3, ChronoUnit.DECADES); // '2046-02-26T23:55:42.123'
582
+ dt.minus(3, ChronoUnit.DECADES); // '1986-02-26T23:55:42.123'
583
+
584
+ // add subtract a Period of 3 Months and 3 Days
585
+ dt.plus(Period.ofMonths(3).plusDays(3)); // '2016-05-29T23:55:42.123'
586
+ dt.minus(Period.ofMonths(3).plusDays(3)); // '2015-11-23T23:55:42.123'
587
+
588
+ // add/subtract 12 hours
589
+ dt.plusHours(12); // '2016-02-27T11:55:42.123'
590
+ dt.minusHours(12); // '2016-02-26T11:55:42.123'
591
+
592
+ // add/subtract 30 minutes
593
+ dt.plusMinutes(30); // '2016-02-27T00:25:42.123'
594
+ dt.minusMinutes(30); // '2016-02-26T23:25:42.123'
595
+
596
+ // add/subtract 30 seconds
597
+ dt.plusSeconds(30); // '2016-02-26T23:56:12.123'
598
+ dt.minusSeconds(30); // '2016-02-26T23:55:12.123'
599
+
600
+ // add/subtract 1 million nanoseconds (1 millisecond)
601
+ dt.plusNanos(1000000); // '2016-02-26T23:55:42.124'
602
+ dt.minusNanos(1000000); // '2016-02-26T23:55:42.122'
603
+
604
+ // add/subtract a time-based unit
605
+ dt.plus(1, ChronoUnit.MILLIS); // '2016-02-26T23:55:42.124'
606
+ dt.plus(1, ChronoUnit.HALF_DAYS); // '2016-02-26T11:55:42.123'
607
+
608
+ // add/subtract a duration of 30 hours and 45 minutes
609
+ dt.plus(Duration.ofHours(30).plusMinutes(45)); // '2016-02-28T06:40:42.123'
610
+ dt.minus(Duration.ofHours(30).plusMinutes(45)); // '2016-02-25T17:10:42.123'
611
+ ```
612
+
613
+ ### Alter specific fields of a `LocalDateTime` instance
614
+
615
+ ```javascript
616
+ var dt = LocalDateTime.parse('2016-02-26T23:55:42.123');
617
+
618
+ // set the hour of day to 1
619
+ dt.withHour(1); // '2016-02-26T01:55:42.123'
620
+
621
+ // set the minute of hour to 1
622
+ dt.withMinute(1); // '2016-02-26T23:01:42.123'
623
+
624
+ // set the second of minute to 1
625
+ dt.withSecond(1); // '2016-02-26T23:55:01.123'
626
+
627
+ // set the nanosecond of second to 1
628
+ dt.withNano(0); // '2016-02-26T23:55:42'
629
+
630
+ // set the millisecond of second to 51
631
+ dt.with(ChronoField.MILLI_OF_SECOND, 51); // '2016-02-26T23:55:42.051'
632
+
633
+ // set by a custom TemporalAdjuster that adjusts to the next even second
634
+ var nextEvenSecond = {
635
+ adjustInto: function(t) {
636
+ return t.second() % 2 === 0 ? t.plusSeconds(2) : t.plusSeconds(1);
637
+ },
638
+ };
639
+ dt.with(nextEvenSecond); // '2016-02-26T23:55:44.123'
640
+ dt.plusSeconds(1).with(nextEvenSecond); // '2016-02-26T23:55:44.123'
641
+ ```
642
+
643
+ ### Truncate a `LocalDateTime` instance
644
+
645
+ ```javascript
646
+ var dt = LocalDateTime.parse('2016-02-26T23:55:42.123');
647
+
648
+ dt.truncatedTo(ChronoUnit.SECONDS); // '2016-02-26T23:55:42'
649
+ dt.truncatedTo(ChronoUnit.MINUTES); // '2016-02-26T23:55:00'
650
+ dt.truncatedTo(ChronoUnit.HOURS); // '2016-02-26T23:00'
651
+ dt.truncatedTo(ChronoUnit.HALF_DAYS); // '2016-02-26T12:00'
652
+ dt.truncatedTo(ChronoUnit.DAYS); // '2016-02-26T00:00'
653
+ ```
654
+
655
+ ### Compare `LocalDateTime` instances
656
+
657
+ ```javascript
658
+ var dt1 = LocalDateTime.parse('2016-02-26T23:55:42.123');
659
+ var dt2 = dt1.plusHours(2);
660
+
661
+ dt1.isAfter(dt2); // false
662
+ dt1.isBefore(dt2); // true
663
+
664
+ dt1.equals(dt1.plusHours(0)); // true
665
+ dt1.equals(dt1.plusHours(1)); // false
666
+
667
+ dt1.compareTo(dt1) === 0; // true
668
+ dt1.compareTo(dt2) < 0; // true
669
+ dt2.compareTo(dt1) > 0; // true
670
+
671
+ // Warn! hashCode is equal if in insances are equal, but might be equal for unequal instances as well
672
+ dt1.hashCode(); // -2036645668
673
+ dt2.hashCode(); // 1459191821
674
+ dt1.hashCode() !== dt2.hashCode(); // true
675
+ ```
676
+
677
+ ### Distance between two `LocalDateTime` instances
678
+
679
+ ```javascript
680
+ var dt1 = LocalDateTime.parse('2016-02-26T23:55:42.123');
681
+ var dt2 = dt1
682
+ .plusYears(6)
683
+ .plusMonths(12)
684
+ .plusHours(2)
685
+ .plusMinutes(42)
686
+ .plusSeconds(12);
687
+
688
+ // obtain the duration between the two dates
689
+ dt1.until(dt2, ChronoUnit.YEARS); // 7
690
+ dt1.until(dt2, ChronoUnit.MONTHS); // 84
691
+ dt1.until(dt2, ChronoUnit.WEEKS); // 356
692
+ dt1.until(dt2, ChronoUnit.DAYS); // 2557
693
+ dt1.until(dt2, ChronoUnit.HOURS); // 61370
694
+ dt1.until(dt2, ChronoUnit.MINUTES); // 3682242
695
+ dt1.until(dt2, ChronoUnit.SECONDS); // 220934532
696
+ ```
697
+
698
+ ### Convert from a `moment` or JavaScript `Date`
699
+
700
+ ```javascript
701
+ // obtain a LocalDateTime instance from a JavaScript Date
702
+
703
+ // the manual way
704
+ var t = LocalDateTime.ofInstant(
705
+ Instant.ofEpochMilli(new Date().getTime())
706
+ );
707
+ // the recommended way with the JavaScript temporal
708
+ t = LocalDateTime.from(nativeJs(new Date()));
709
+ // converting from a moment works the same way
710
+ d = LocalDateTime.from(nativeJs(moment()));
711
+ ```
712
+
713
+ ## ZonedDateTime
714
+
715
+ A `ZonedDateTime` represents a date-time with a [time offset](https://en.wikipedia.org/wiki/UTC_offset) and/or a [time zone](https://en.wikipedia.org/wiki/Time_zone) in the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar system.
716
+
717
+ On its own, `ZonedDateTime` only supports specifying **time offsets** such as `UTC` or `UTC+02:00`, plus the `SYSTEM` time zone ID.
718
+
719
+ ### The `SYSTEM` zone ID
720
+
721
+ The `SYSTEM` zone ID is a non-standard ID that is specific to `js-joda`. It represents the default time zone of the current JavaScript runtime. The JavaScript spec does not provide an API this; it only provides the system default time offset for a point in the timeline (`Date.prototype.getTimezoneOffset()`).
722
+
723
+ You should not exchange `ZonedDateTime` instances using the `SYSTEM` zone ID between JavaScript environments (e.g. between server and client, or between two servers). The time offset on another machine won't necessarily be the same as yours. Before sending a `ZonedDateTime` to someone else, convert it to a fixed offset:
724
+
725
+ ```javascript
726
+ // current time with default `SYSTEM`
727
+ ZonedDateTime.now().toString(); // e.g. 2016-03-18T12:38:23.561+01:00[SYSTEM]
728
+
729
+ // converted to a fixed time offset
730
+ ZonedDateTime.now()
731
+ .withFixedOffsetZone()
732
+ .toString(); // e.g. 2016-03-18T12:38:23.561+01:00
733
+ ```
734
+
735
+ ### Working with time zones
736
+
737
+ A **time zone** and a **time offset** are [not the same thing](https://en.wikipedia.org/wiki/UTC_offset#Time_zones_and_time_offsets). Some timezones change from standard time to [daylight savings time](https://en.wikipedia.org/wiki/Daylight_saving_time) and back every year:
738
+
739
+ - In the `Europe/Berlin` _time zone_, the _time offset_ is `UTC+2` during the summer, and `UTC+1` during the rest of the year.
740
+ - In the `Africa/Lagos` _time zone_, on the other hand, the _time offset_ is `UTC+1` all year round.
741
+
742
+ Calculations that might span time zones or daylight savings transitions need to reference the time zone, not just the offset.
743
+
744
+ The @js-joda/timezone package provides bindings to the the [IANA tz database](https://www.iana.org/time-zones), making `joda-js`'s calculations time zone aware. The `tz` database uses zone names like `Africa/Bujumbura`, `America/New_York`, and `Europe/Lisbon` (see the [full list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)).
745
+
746
+ To specify time zones using these names, you just need to `require` @js-joda/timezone.
747
+
748
+ ```javascript
749
+ var jsJoda = require('@js-joda/core');
750
+ require('@js-joda/timezone');
751
+
752
+ var zdt = ZonedDateTime.now(ZoneId.of('Europe/Paris'));
753
+ ```
754
+
755
+ ### Create a ZonedDateTime
756
+
757
+ ```javascript
758
+ // get now with the default system time zone
759
+ ZonedDateTime.now().toString(); // e.g. 2016-03-18T12:38:23.561+01:00[SYSTEM]
760
+
761
+ // get now with the UTC time zone
762
+ ZonedDateTime.now(ZoneOffset.UTC).toString(); // e.g. 2016-03-18T11:38:23.561Z
763
+
764
+ // get now with a fixed offset time zone
765
+ ZonedDateTime.now(ZoneId.of('UTC-05:00')).toString(); // e.g. 2016-03-18T06:38:23.561-05:00[UTC-05:00]
766
+
767
+ // get now with a ZoneRegion (requires `@js-joda/timezone`)
768
+ ZonedDateTime.now(ZoneId.of('Europe/Paris')).toString(); // e.g. 2017-02-04T17:01:15.846+01:00[Europe/Paris]
769
+
770
+ // parse a date time with a time zone ISO String
771
+ ZonedDateTime.parse('2016-03-18T12:38:23.561+01:00[SYSTEM]');
772
+ ZonedDateTime.parse('2016-03-18T12:38:23.561+01:00');
773
+ ZonedDateTime.parse('2016-03-18T11:38:23.561Z');
774
+ ZonedDateTime.parse('2016-03-18T06:38:23.561-05:00[UTC-05:00]');
775
+ ZonedDateTime.parse('2017-02-04T17:01:15.846+01:00[Europe/Paris]');
776
+
777
+ // create from a LocalDate(Time) (requires `@js-joda/timezone`)
778
+ LocalDate.parse('2012-06-06')
779
+ .atStartOfDay()
780
+ .atZone(ZoneId.of('Europe/Paris')); // 2012-06-06T00:00+02:00[Europe/Paris]
781
+ ZonedDateTime.of(
782
+ LocalDateTime.parse('2012-06-06T00:00'),
783
+ ZoneId.of('Europe/Paris')
784
+ ); // 2012-06-06T00:00+02:00[Europe/Paris]
785
+ ZonedDateTime.of(
786
+ LocalDate.parse('2012-06-06'),
787
+ LocalTime.MIDNIGHT,
788
+ ZoneId.of('Europe/Paris')
789
+ ); // 2012-06-06T00:00+02:00[Europe/Paris]
790
+
791
+ // create from an Instant
792
+ ZonedDateTime.ofInstant(Instant.now(), ZoneId.SYSTEM); // current system time
793
+ ```
794
+
795
+ ### Switch time zones
796
+
797
+ > These examples require `@js-joda/timezone`.
798
+
799
+ ```javascript
800
+ var d = LocalDate.of(2016, 3, 18);
801
+ var zdt = d.atTime(LocalTime.NOON).atZone(ZoneId.of('America/New_York')); //2016-03-18T12:00-04:00[America/New_York]
802
+
803
+ // switch time zone retaining the local date-time if possible
804
+ zdt.withZoneSameLocal(ZoneId.of('Europe/Berlin')); // 2016-03-18T12:00+01:00[Europe/Berlin]
805
+
806
+ // switch time zone and retain the instant
807
+ zdt.withZoneSameInstant(ZoneId.of('Europe/Berlin')); // 2016-03-18T17:00+01:00[Europe/Berlin]
808
+ ```
809
+
810
+ ### Get and manipulate values from a `ZonedDateTime`
811
+
812
+ `ZonedDateTime` implements the same methods as `LocalDateTime` for getting or setting values. See [the examples above](#get-values-from-localdatetime) for `LocalDateTime`.
813
+
814
+ ### Calculate values across daylight savings transitions
815
+
816
+ When adding to or subtracting from a `ZonedDateTime` instance, the calculation is different depending on whether date or time units are passed.
817
+
818
+ - Addition/subtraction of **date units** are made on the **local** timeline.
819
+ - Addition/subtraction of **time units** are made on the **instant** timeline.
820
+
821
+ This example shows the difference for a daylight saving transition.
822
+
823
+ ```javascript
824
+ // assume the system default time zone is CET; we define a time as 2016-03-18 at 17:00 local time
825
+ var zdt = ZonedDateTime.parse('2016-03-18T17:00+01:00[Europe/Berlin]');
826
+
827
+ // adding a date unit of 2 weeks, crossing a daylight saving transition
828
+ zdt.plusWeeks(2); // 2016-04-01T17:00+02:00[Europe/Berlin] (still 17:00)
829
+
830
+ // adding a time unit of 2 weeks (2 * 7 * 24)
831
+ zdt.plusHours(2 * 7 * 24); // 2016-04-01T18:00+02:00[Europe/Berlin] (now 18:00)
832
+ ```
833
+
834
+ ## Period
835
+
836
+ `Period` is a **date-based** amount of time in the ISO-8601 calendar system, such as '2 years, 3 months and 4 days'.
837
+
838
+ ```javascript
839
+ // parse and format ISO 8601 period strings
840
+ Period.parse('P1Y10M').toString(); // 'P1Y10M'
841
+
842
+ // obtain a Period of 10 years, 5 month and 30 days
843
+ Period.of(10, 5, 30).toString(); // 'P10Y5M30D'
844
+
845
+ // 10 years
846
+ Period.ofYears(10).toString(); // 'P10Y'
847
+
848
+ // add 45 days to a Period
849
+ Period.ofYears(10)
850
+ .plusDays(45)
851
+ .toString(); // 'P10Y45D'
852
+
853
+ // normalize a Period of years and month
854
+ Period.of(1, 37, 0)
855
+ .normalized()
856
+ .toString(); // 'P4Y1M'
857
+
858
+ // add/subtract from a Period
859
+ Period.ofYears(10)
860
+ .plusMonths(10)
861
+ .minusDays(42)
862
+ .toString(); // 'P10Y10M-42D'
863
+
864
+ // add a Period to LocalDate
865
+ var p = Period.ofMonths(1);
866
+ LocalDate.parse('2012-12-12').plus(p); // '2013-01-12';
867
+ LocalDate.parse('2012-01-31').plus(p); // '2012-02-29';
868
+ LocalDateTime.parse('2012-05-31T12:00').plus(p); // '2012-06-30T12:00';
869
+
870
+ // calculate the Period between two Dates
871
+ Period.between(
872
+ LocalDate.parse('2012-06-30'),
873
+ LocalDate.parse('2012-08-31')
874
+ ); // 'P2M1D'
875
+ ```
876
+
877
+ ## Duration
878
+
879
+ `Duration` is a **time-based** amount of time, such as '34.5 seconds'.
880
+
881
+ ```javascript
882
+ // obtain a Duration of 10 hours
883
+ Duration.ofHours(10).toString(); // 'PT10H'
884
+
885
+ // obtain a Duration of 10 days (10 x 24 hours)
886
+ Duration.ofDays(10).toString(); // 'PT240H'
887
+
888
+ // add/subtract a duration from a LocalDateTime
889
+ var dt = LocalDateTime.parse('2012-12-24T12:00');
890
+
891
+ dt.plus(Duration.ofHours(10).plusMinutes(30)).toString(); // '2012-12-24T22:30'
892
+ dt.minus(Duration.ofHours(12).multipliedBy(10)).toString(); // '2012-12-19T12:00'
893
+
894
+ // calculate the durations beetween to time-based temporals
895
+ var dt1 = LocalDateTime.parse('2012-12-24T12:00');
896
+
897
+ Duration.between(dt1, dt1.plusHours(10)).toString(); // 'PT10H'
898
+ ```
899
+
900
+ ## Customizing js-joda
901
+
902
+ This package is extensible, allowing you to create your own custom temporal calculations. See the temporal interface documentation for more information.
903
+
904
+ ### Custom temporal adjuster
905
+
906
+ ```javascript
907
+ // implement a TemporalAdjuster that the next or same even day of month
908
+ var nextOrSameEvenDay = {
909
+ adjustInto: function(t) {
910
+ return t.dayOfMonth() % 2 === 0 ? t : t.plusDays(1);
911
+ },
912
+ };
913
+
914
+ LocalDateTime.parse('2012-12-23T12:00').with(nextOrSameEvenDay); // '2012-12-24T12:00'
915
+ LocalDate.parse('2012-12-24').with(nextOrSameEvenDay); // '2012-12-24'
916
+ ```
917
+
918
+ ### Custom temporal fields and temporal units
919
+
920
+ See the source for temporal/IsoFields as an example how to implement custom fields and units. `IsoFields` implements fields and units for an ISO week-based year.
921
+
922
+ ### Custom formatter and queries
923
+
924
+ The following example implements a parser for a local date with an optional local time. It returns either a `LocalDate` or a `LocalDateTime`, depending on the parsed fields.
925
+
926
+ ```javascript
927
+ // build a custom date time formatter where the time field is optional
928
+ var OPTIONAL_FORMATTER = DateTimeFormatter.ofPattern(
929
+ 'yyyy-MM-dd['T'HH:mm[:ss]]'
930
+ );
931
+
932
+ // create a temporal query that create a new Temporal depending on the existing fields
933
+ dateOrDateTimeQuery = {
934
+ queryFrom: function(temporal) {
935
+ var date = temporal.query(TemporalQueries.localDate());
936
+ var time = temporal.query(TemporalQueries.localTime());
937
+ if (time == null) return date;
938
+ else return date.atTime(time);
939
+ }
940
+ };
941
+
942
+ localDate = OPTIONAL_FORMATTER.parse('2012-12-24', dateOrDateTimeQuery);
943
+ localDateTime = OPTIONAL_FORMATTER.parse(
944
+ '2012-12-24T23:59',
945
+ dateOrDateTimeQuery
946
+ );
947
+ ```