@bigbinary/neeto-time-zones 0.5.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.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @neetohq/timezones
2
+
3
+ ![npm version](https://img.shields.io/npm/v/@neetohq/timezones.svg) ![license](https://img.shields.io/npm/l/@neetohq/timezones.svg)
4
+
5
+ A simple and lightweight NPM package for working with time zones. This package provides a human friendly timezone selector and utility functions for timezones.
6
+
7
+
8
+ ## Installation
9
+
10
+ You can install the package using npm:
11
+
12
+ ```bash
13
+ npm install @neetohq/timezones
14
+ ```
15
+
16
+
17
+ ## NeetoTimezoneSelector
18
+
19
+ [Check out the live demo](https://codepen.io/Jijin-Haridas/full/wvQbeOr)
20
+ ```js
21
+ import { NeetoTimezoneSelector } from "@neetohq/timezones";
22
+
23
+ new NeetoTimezoneSelector(document.getElementById("elementId"));
24
+ ```
25
+
26
+ ### Configuration
27
+ You can pass options as the second parameter to configure the timezone selector component.
28
+
29
+ 1. elementId: ID for the NeetoTimezoneSelector. By default the ID will be `timezone-selector`
30
+ 2. className: Custom classes that can be added to the component.
31
+ 3. onChange: Function to be called when the timezone selector changes.
32
+ 4. position: Position in which the selector should open in. Available options: `top`, `bottom`. Default position is `bottom`.
33
+ 5. onHourFormatChange: Function to be called when the time format changes.
34
+
35
+ ```js
36
+ import { NeetoTimezoneSelector } from "@neetohq/timezones";
37
+
38
+ new NeetoTimezoneSelector(document.getElementById("elementId"), {
39
+ className: "custom-selector-class",
40
+ onChange: (timezone) => {
41
+ console.log(timezone);
42
+ },
43
+ elementId: "custom-selector-element",
44
+ position: "top",
45
+ });
46
+ ```
47
+
48
+ ### ianaTimezoneToHumanReadble
49
+
50
+ ```js
51
+ import { ianaTimezoneToHumanReadable } from "@neetohq/timezones";
52
+
53
+ ianaTimezoneToHumanReadable("Asia/Calcutta") // => Indian Standard Time
54
+
55
+ ianaTimezoneToHumanReadable("America/New_York") // => Eastern Standard Time
56
+
57
+ ianaTimezoneToHumanReadable("Europe/Berlin") // => Central Standard Time
58
+ ```
59
+
60
+ ## Development
61
+
62
+ ### Clone the repo
63
+
64
+ ```bash
65
+ git clone git@github.com:neetohq/neeto-timezones.git
66
+ cd neeto-timezones/js
67
+ pnpm install
68
+ pnpm dev
69
+ ```
70
+
71
+ ### Publishing to npm
72
+
73
+ 1. Bump `package.json` version
74
+ 2. Commit and push
75
+ 3. `pnpm build && pnpm publish`