react-timezone-select 3.2.5 → 3.2.7

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 (2) hide show
  1. package/dist/index.js +7 -4
  2. package/package.json +16 -16
package/dist/index.js CHANGED
@@ -149,7 +149,7 @@ function useTimezoneSelect({
149
149
  label = `${prefix} ${altName ? `(${altName})` : ""}`;
150
150
  break;
151
151
  case "abbrev":
152
- label = `${prefix} (${abbr})`;
152
+ label = `${prefix} ${abbr ? `(${abbr})` : ""}`;
153
153
  break;
154
154
  case "offsetHidden":
155
155
  label = `${prefix.replace(/^\(.*?\)\s*/, "")}`;
@@ -196,13 +196,16 @@ function useTimezoneSelect({
196
196
  return { tz, score };
197
197
  }).sort((a, b) => b.score - a.score)) == null ? void 0 : _a[0]) == null ? void 0 : _b.tz;
198
198
  };
199
+ function isObject(item) {
200
+ return typeof item === "object" && !Array.isArray(item) && item !== null;
201
+ }
199
202
  const parseTimezone = (zone) => {
200
- if (typeof zone === "object" && zone.value && zone.label)
201
- return zone;
202
203
  if (typeof zone === "string") {
203
204
  return options.find((tz) => tz.value === zone) || zone.indexOf("/") !== -1 && findFuzzyTz(zone);
204
- } else if (zone.value && !zone.label) {
205
+ } else if (isObject(zone) && !zone.label) {
205
206
  return options.find((tz) => tz.value === zone.value);
207
+ } else {
208
+ return zone;
206
209
  }
207
210
  };
208
211
  return { options, parseTimezone };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-timezone-select",
3
- "version": "3.2.5",
3
+ "version": "3.2.7",
4
4
  "description": "Usable, dynamic React Timezone Select",
5
5
  "author": "Nico Domino <yo@ndo.dev>",
6
6
  "homepage": "https://github.com/ndom91/react-timezone-select",
@@ -41,34 +41,34 @@
41
41
  "timezone-soft": "^1.5.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@babel/core": "^7.24.5",
45
- "@testing-library/jest-dom": "^6.4.5",
46
- "@testing-library/react": "^15.0.7",
44
+ "@babel/core": "^7.24.9",
45
+ "@testing-library/jest-dom": "^6.4.8",
46
+ "@testing-library/react": "^16.0.0",
47
47
  "@types/jest": "^29.5.12",
48
- "@types/react": "^18.3.2",
48
+ "@types/react": "^18.3.3",
49
49
  "@types/react-dom": "^18.3.0",
50
50
  "@types/testing-library__jest-dom": "^5.14.9",
51
- "@typescript-eslint/eslint-plugin": "^7.9.0",
52
- "@typescript-eslint/parser": "^7.9.0",
53
- "@vitejs/plugin-react": "^4.2.1",
51
+ "@typescript-eslint/eslint-plugin": "^7.17.0",
52
+ "@typescript-eslint/parser": "^7.17.0",
53
+ "@vitejs/plugin-react": "^4.3.1",
54
54
  "concurrently": "^8.2.2",
55
- "esbuild": "^0.21.3",
55
+ "esbuild": "^0.23.0",
56
56
  "esbuild-jest": "^0.5.0",
57
57
  "eslint": "^8.57.0",
58
58
  "eslint-config-prettier": "^9.1.0",
59
- "eslint-plugin-prettier": "5.1.3",
59
+ "eslint-plugin-prettier": "5.2.1",
60
60
  "gh-pages": "^6.1.1",
61
61
  "jest-environment-jsdom": "^29.7.0",
62
- "prettier": "^3.2.5",
62
+ "prettier": "^3.3.3",
63
63
  "react": "^18.2.0",
64
64
  "react-dom": "^18.2.0",
65
65
  "simple-git-hooks": "^2.11.1",
66
- "ts-jest": "^29.1.2",
67
- "tsup": "^8.0.2",
68
- "typescript": "^5.4.5",
69
- "vite": "^5.2.11",
66
+ "ts-jest": "^29.2.3",
67
+ "tsup": "^8.2.2",
68
+ "typescript": "^5.5.4",
69
+ "vite": "^5.3.4",
70
70
  "vite-tsconfig-paths": "^4.3.2",
71
- "vitest": "^1.6.0"
71
+ "vitest": "^2.0.4"
72
72
  },
73
73
  "eslintConfig": {
74
74
  "parser": "@typescript-eslint/parser",