@jobber/components 4.87.7-taylor-sty.2 → 4.87.8-JOB-92181.1

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.
@@ -26,7 +26,8 @@ function FormatTime({ time: inputTime, use24HourClock, }) {
26
26
  return React__default["default"].createElement(React__default["default"].Fragment, null, formatCivilTime(dateObject, use24HourClock));
27
27
  }
28
28
  function formatCivilTime(date, use24HourClock) {
29
- return date.toLocaleTimeString(navigator.language, {
29
+ const language = (globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) ? navigator.language : "en";
30
+ return date.toLocaleTimeString(language, {
30
31
  hourCycle: use24HourClock ? "h23" : "h12",
31
32
  minute: "2-digit",
32
33
  hour: "numeric",
@@ -44,15 +44,18 @@ function htmlTimeToCivilTime(timeString) {
44
44
 
45
45
  const DEBOUNCE_TIME = 300;
46
46
  function useTimePredict({ value, handleChange }) {
47
- const IS_12_HOUR_FORMAT = React.useRef(Intl.DateTimeFormat(navigator.language, {
48
- hour: "numeric",
49
- }).resolvedOptions().hour12);
47
+ const [IS_12_HOUR_FORMAT, set12HourFormat] = React.useState(false);
50
48
  const [typedTime, setTypedTime] = React.useState("");
51
49
  const predictTime = React.useCallback(debounce__default["default"](() => {
52
50
  if (value)
53
51
  return;
54
- handleChange(predictHours(typedTime, IS_12_HOUR_FORMAT.current));
55
- }, DEBOUNCE_TIME), [typedTime, value, handleChange]);
52
+ handleChange(predictHours(typedTime, IS_12_HOUR_FORMAT));
53
+ }, DEBOUNCE_TIME), [typedTime, value, handleChange, IS_12_HOUR_FORMAT]);
54
+ React.useEffect(() => {
55
+ set12HourFormat(Boolean(Intl.DateTimeFormat(navigator.language, {
56
+ hour: "numeric",
57
+ }).resolvedOptions().hour12));
58
+ }, []);
56
59
  /**
57
60
  * Predict the hour when user types a number
58
61
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.87.7-taylor-sty.2+50cb8504",
3
+ "version": "4.87.8-JOB-92181.1+8c76d37e",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -80,5 +80,5 @@
80
80
  "> 1%",
81
81
  "IE 10"
82
82
  ],
83
- "gitHead": "50cb85043e9e1f5be97083805b2b048758fbd78d"
83
+ "gitHead": "8c76d37e150b336ea3225b79a0e382922e66e3b1"
84
84
  }