playbook_ui 12.38.0 → 12.39.0.pre.alpha.salesbookmismatchingdate1114

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
  3. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
  4. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +10 -9
  5. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  6. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  7. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +4 -8
  8. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  9. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  10. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
  12. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
  13. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
  14. data/app/pb_kits/playbook/pb_kit/dateTime.ts +41 -36
  15. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +280 -17
  16. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  17. data/app/pb_kits/playbook/pb_nav/_item.tsx +35 -22
  18. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  19. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
  20. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  21. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +85 -58
  22. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
  23. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
  24. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
  25. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
  26. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +14 -5
  27. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
  28. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
  29. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  30. data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
  31. data/app/pb_kits/playbook/pb_nav/item.rb +29 -3
  32. data/app/pb_kits/playbook/pb_select/_select.scss +76 -0
  33. data/app/pb_kits/playbook/pb_select/_select.tsx +9 -5
  34. data/app/pb_kits/playbook/pb_select/docs/_select_attributes.html.erb +26 -0
  35. data/app/pb_kits/playbook/pb_select/docs/_select_attributes.md +1 -0
  36. data/app/pb_kits/playbook/pb_select/docs/_select_multiple.html.erb +36 -0
  37. data/app/pb_kits/playbook/pb_select/docs/_select_multiple.jsx +50 -0
  38. data/app/pb_kits/playbook/pb_select/docs/_select_multiple.md +1 -0
  39. data/app/pb_kits/playbook/pb_select/docs/example.yml +3 -0
  40. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  41. data/app/pb_kits/playbook/pb_select/select.html.erb +5 -9
  42. data/app/pb_kits/playbook/pb_select/select.rb +14 -0
  43. data/app/pb_kits/playbook/pb_select/select.test.js +17 -0
  44. data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
  45. data/dist/playbook-rails.js +2 -2
  46. data/lib/playbook/version.rb +2 -2
  47. metadata +21 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7c4ddd52da1fe9859284946ec51d75106349052abe11a99bc4401bf730084e7
4
- data.tar.gz: 667ba4c62fbcbdb517e9bfdacdb6c3c28519e7bf987773e242598df435262da4
3
+ metadata.gz: 53e1efed14125432de973864540db434bd15d7ca728af5bfd7facb459c42f3a5
4
+ data.tar.gz: 8ea21f9bdf376162e82ab98a9d14b3f186e8438d81a979faa663ffad1f3b57f7
5
5
  SHA512:
6
- metadata.gz: 30ccec62ad8d83690b6582e2505bb64f54a2fdc95e8fa910a455ed5fbb1158c10e89e1470ca9991dcc9d85b326f714ea4e01f5b89d940001bf71d11e59a07396
7
- data.tar.gz: 5e8e812054d8296686d593cd3626eafee70e76529285d61834132677e72462ed035582fe0ceb7706e23bda2ce4988716139c42bfeaa619d0ad9280d95d9658f9
6
+ metadata.gz: 5b78591f4053df9f189134735a3689c5e010f823220d0217c65f222240a1aed961f8cdb79df3f91e771f7336717031dfd2594064388e3f9478549d0281f78724
7
+ data.tar.gz: 93d06173adcc6db7672b2580de009a31d530c0135802524b0d5514d09939737230c38dd845f47c862a9be503eb6c42916372498afc5481d54f7c2afe495f6644
@@ -20,6 +20,12 @@
20
20
  .icon_wrapper:hover {
21
21
  color: $primary
22
22
  }
23
+
24
+ .dark {
25
+ .pb_icon_kit {
26
+ color: $white;
27
+ }
28
+ }
23
29
  }
24
30
 
25
31
  [class^=pb_collapsible_main_kit] {
@@ -20,7 +20,7 @@ type CollapsibleProps = {
20
20
  icon?: string | string[],
21
21
  iconColor?: 'default' | 'light' | 'lighter' | 'link' | 'error' | 'success',
22
22
  iconSize?: IconSizes,
23
- iconClick?: ()=> void,
23
+ onIconClick?: ()=> void,
24
24
  onClick?: ()=> void,
25
25
  id?: string,
26
26
  }
@@ -36,7 +36,7 @@ const Collapsible = ({
36
36
  icon,
37
37
  iconColor = 'default',
38
38
  iconSize,
39
- iconClick,
39
+ onIconClick,
40
40
  onClick,
41
41
  id,
42
42
  ...props
@@ -66,7 +66,7 @@ const Collapsible = ({
66
66
  className
67
67
  )
68
68
  return (
69
- <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, iconClick, onClick }}>
69
+ <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick }}>
70
70
  <div
71
71
  {...ariaProps}
72
72
  {...dataProps}
@@ -33,6 +33,7 @@ type CollapsibleMainProps = {
33
33
  children: React.ReactNode[] | React.ReactNode,
34
34
  className?: string,
35
35
  cursor?: string,
36
+ dark?: boolean,
36
37
  onClick?: ()=> void
37
38
  }
38
39
  type IconColors = "default" | "light" | "lighter" | "link" | "error" | "success"
@@ -42,10 +43,10 @@ type IconProps = {
42
43
  icon?: string[] | string
43
44
  iconColor?: IconColors
44
45
  iconSize?: IconSizes
45
- iconClick?: ()=> void
46
+ onIconClick?: ()=> void
46
47
  }
47
48
 
48
- const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, iconClick }: IconProps) => {
49
+ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, onIconClick }: IconProps) => {
49
50
  const color = colorMap[iconColor]
50
51
 
51
52
  const showIcon = (icon: string |string[]) => {
@@ -56,9 +57,9 @@ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, iconClick }: IconPro
56
57
  }
57
58
 
58
59
  const handleIconClick = (e:any) => {
59
- if (iconClick) {
60
+ if (onIconClick) {
60
61
  e.stopPropagation();
61
- iconClick()
62
+ onIconClick()
62
63
  }
63
64
  }
64
65
 
@@ -93,18 +94,18 @@ const CollapsibleMain = ({
93
94
  cursor = 'pointer',
94
95
  ...props
95
96
  }: CollapsibleMainProps): React.ReactElement=> {
96
- const {collapsed, toggle, icon, iconSize, iconColor, iconClick, onClick}: any = useContext(CollapsibleContext)
97
+ const {collapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick}: any = useContext(CollapsibleContext)
97
98
  const mainCSS = buildCss('pb_collapsible_main_kit')
98
99
  const mainSpacing = globalProps(props, { cursor })
99
100
 
100
- const handleCollapsibleClick = (e:any) => {
101
+ const handleCollapsibleClick = () => {
101
102
  toggle();
102
- onClick && onClick(e)
103
+ onClick && onClick()
103
104
  }
104
105
 
105
106
  return (
106
107
  <div className={classnames(mainCSS, className, mainSpacing)}>
107
- <div onClick={(e)=>handleCollapsibleClick(e)}>
108
+ <div onClick={handleCollapsibleClick}>
108
109
  <Flex
109
110
  spacing="between"
110
111
  vertical="center"
@@ -116,7 +117,7 @@ const CollapsibleMain = ({
116
117
  iconColor={iconColor as IconColors}
117
118
  iconSize={iconSize as IconSizes}
118
119
  icon={icon as string[] | string}
119
- iconClick={iconClick}
120
+ onIconClick={onIconClick}
120
121
  />
121
122
  </FlexItem>
122
123
  </Flex>
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleColor = () => (
4
+ const CollapsibleColor = (props) => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconColor='default'
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main>
10
+ <Collapsible.Main {...props}>
11
11
  <div>{'Default Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleDefault = () => (
4
+ const CollapsibleDefault = (props) => (
5
5
  <Collapsible >
6
- <Collapsible.Main>
6
+ <Collapsible.Main {...props}>
7
7
  <div>{'Main Section'}</div>
8
8
  </Collapsible.Main>
9
9
  <Collapsible.Content>
@@ -1,18 +1,14 @@
1
1
  import React from 'react'
2
- import { Collapsible, useCollapsible, Button } from '../..'
2
+ import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleIcons = () => {
5
- const [isCollapsed, setIsCollapsed] = useCollapsible(true)
4
+ const CollapsibleIcons = (props) => {
6
5
 
7
6
  return (
8
7
  <>
9
- <Button onClick={()=> setIsCollapsed(!isCollapsed)}>
10
- {isCollapsed ? "Expand" : "Collapse"}
11
- </Button>
12
- <Collapsible collapsed={isCollapsed}
8
+ <Collapsible
13
9
  icon={['plus','minus']}
14
10
  >
15
- <Collapsible.Main>
11
+ <Collapsible.Main {...props}>
16
12
  <div>{'Main Section'}</div>
17
13
  </Collapsible.Main>
18
14
  <Collapsible.Content>
@@ -1,2 +1,2 @@
1
1
  ##### Prop
2
- This kit uses 'chevron-up' and 'chevron-down' icons as default for the toggle icons. To customize these icons, use the `icon` prop to pass in an array of two icons, the first will render when the collapisble is closed and the second will render when the collapsible is open. In this example, we are using `icon: ['plus','minus']`
2
+ The `icon` prop allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when collapsed (chevron-down), and the second value will replace the default icon when expanded (chevron-up). `icon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the collapsible state.
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleSize = () => (
4
+ const CollapsibleSize = (props) => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconSize="xs"
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main>
10
+ <Collapsible.Main {...props}>
11
11
  <div>{'Extra Small Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -22,7 +22,7 @@ const CollapsibleSize = () => (
22
22
  iconSize="sm"
23
23
  marginBottom="xs"
24
24
  >
25
- <Collapsible.Main>
25
+ <Collapsible.Main {...props}>
26
26
  <div>{'Small Section'}</div>
27
27
  </Collapsible.Main>
28
28
  <Collapsible.Content>
@@ -36,7 +36,7 @@ const CollapsibleSize = () => (
36
36
  <Collapsible
37
37
  marginBottom="xs"
38
38
  >
39
- <Collapsible.Main>
39
+ <Collapsible.Main {...props}>
40
40
  <div>{'Default Section'}</div>
41
41
  </Collapsible.Main>
42
42
  <Collapsible.Content>
@@ -51,7 +51,7 @@ const CollapsibleSize = () => (
51
51
  iconSize="lg"
52
52
  marginBottom="xs"
53
53
  >
54
- <Collapsible.Main>
54
+ <Collapsible.Main {...props}>
55
55
  <div>{'Large Section'}</div>
56
56
  </Collapsible.Main>
57
57
  <Collapsible.Content>
@@ -0,0 +1,75 @@
1
+ import React from 'react'
2
+ import { Collapsible, useCollapsible, Button } from '../..'
3
+
4
+ const CollapsibleState = (props) => {
5
+ const [isCollapsed, setIsCollapsed] = useCollapsible(true)
6
+
7
+ return (
8
+ <>
9
+ <Button
10
+ onClick={() => setIsCollapsed(!isCollapsed)}
11
+ padding="none"
12
+ variant="link"
13
+ >
14
+ {isCollapsed ? "Expand All" : "Collapse All"}
15
+ </Button>
16
+
17
+ <Collapsible
18
+ collapsed={isCollapsed}
19
+ icon={["plus", "minus"]}
20
+ padding="none"
21
+ >
22
+ <Collapsible.Main padding="sm"
23
+ {...props}
24
+ >
25
+ <div>{"Main Section"}</div>
26
+ </Collapsible.Main>
27
+ <Collapsible.Content>
28
+ <div>
29
+ {
30
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
31
+ }
32
+ </div>
33
+ </Collapsible.Content>
34
+ </Collapsible>
35
+ <Collapsible
36
+ collapsed={isCollapsed}
37
+ icon={["plus", "minus"]}
38
+ padding="none"
39
+ >
40
+ <Collapsible.Main padding="sm"
41
+ {...props}
42
+ >
43
+ <div>{"Main Section"}</div>
44
+ </Collapsible.Main>
45
+ <Collapsible.Content>
46
+ <div>
47
+ {
48
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
49
+ }
50
+ </div>
51
+ </Collapsible.Content>
52
+ </Collapsible>
53
+ <Collapsible
54
+ collapsed={isCollapsed}
55
+ icon={["plus", "minus"]}
56
+ padding="none"
57
+ >
58
+ <Collapsible.Main padding="sm"
59
+ {...props}
60
+ >
61
+ <div>{"Main Section"}</div>
62
+ </Collapsible.Main>
63
+ <Collapsible.Content>
64
+ <div>
65
+ {
66
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit."
67
+ }
68
+ </div>
69
+ </Collapsible.Content>
70
+ </Collapsible>
71
+ </>
72
+ )
73
+ }
74
+
75
+ export default CollapsibleState
@@ -0,0 +1,3 @@
1
+ The `collapsed` prop allows you to toggle the collapsible with external controls (like buttons) when used in conjunction with our `useCollapsible` hook.
2
+
3
+ NOTE: you must import and declare the `useCollapsible` hook then pass its state to the collapsed prop of any Collapsible you wish to manage with the external control. See our code example for details.
@@ -2,12 +2,13 @@ examples:
2
2
 
3
3
  rails:
4
4
  - collapsible_default: Default
5
- - collapsible_size: Size
6
- - collapsible_color: Color
7
- # - collapsible_icons: Custom Icons
5
+ - collapsible_size: Icon Size
6
+ - collapsible_color: Icon Color
7
+ - collapsible_icons: Custom Icons
8
8
 
9
9
  react:
10
10
  - collapsible_default: Default
11
- - collapsible_size: Size
12
- - collapsible_color: Color
13
- # - collapsible_icons: Custom Icons
11
+ - collapsible_size: Icon Size
12
+ - collapsible_color: Icon Color
13
+ - collapsible_icons: Custom Icons
14
+ - collapsible_state: useCollapsible Hook
@@ -1,4 +1,5 @@
1
1
  export { default as CollapsibleDefault } from './_collapsible_default.jsx'
2
2
  export { default as CollapsibleSize } from './_collapsible_size.jsx'
3
3
  export { default as CollapsibleColor } from './_collapsible_color.jsx'
4
- export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
4
+ export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
5
+ export {default as CollapsibleState } from './_collapsible_state.jsx'
@@ -17,6 +17,7 @@ const formatDate = (newDate: Date | string) => {
17
17
 
18
18
  export const toMinute = (newDate: Date | string, timeZone?: string): string => {
19
19
  const date = formatDate(newDate)
20
+
20
21
  if (timeZone) {
21
22
  return date.toLocaleTimeString(undefined, { timeZone, hour: "2-digit", minute: "2-digit" }).slice(3, 5);
22
23
  } else {
@@ -26,6 +27,7 @@ export const toMinute = (newDate: Date | string, timeZone?: string): string => {
26
27
 
27
28
  export const toHour = (newDate: Date | string, timeZone?: string): string => {
28
29
  const date = formatDate(newDate)
30
+
29
31
  if (timeZone) {
30
32
  return date.toLocaleTimeString(undefined, { timeZone, hour: "numeric" }).split(' ')[0];
31
33
  } else {
@@ -34,52 +36,53 @@ export const toHour = (newDate: Date | string, timeZone?: string): string => {
34
36
  }
35
37
 
36
38
  export const toDay = (newDate: Date | string, timeZone?: string): number => {
37
- if (timeZone) {
38
- const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
39
- return date.getDate()
40
- } else {
41
- const date = formatDate(newDate)
42
- return date.getDate()
43
- }
39
+ if (timeZone) {
40
+ const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
41
+ return date.getDate()
42
+ } else {
43
+ const date = formatDate(newDate)
44
+ return date.getDate()
45
+ }
44
46
  }
45
47
 
46
48
  export const toDayAbbr = (newDate: Date | string): string => {
47
49
  const date = formatDate(newDate)
48
- return ABBR_DAYS[date.getUTCDay()]
50
+ return ABBR_DAYS[date.getDay()]
49
51
  }
50
52
 
51
53
  export const toWeekday = (newDate: Date | string): string => {
52
- const date = formatDate(newDate)
53
- return days[date.getUTCDay()]
54
+ const date = formatDate(newDate)
55
+ return days[date.getDay()]
54
56
  }
55
57
 
56
58
  export const toMonth = (newDate: Date | string, timeZone?: string): string => {
57
- if (timeZone) {
58
- const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
59
- return months[date.getUTCMonth()]
60
- } else {
61
- const date = formatDate(newDate)
62
- return months[date.getUTCMonth()]
63
- }
59
+ if (timeZone) {
60
+ const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
61
+ return months[date.getMonth()]
62
+ } else {
63
+ const date = formatDate(newDate)
64
+ return months[date.getMonth()]
65
+ }
64
66
  }
65
67
 
66
68
  export const toMonthNum = (newDate: Date | string): number => {
67
69
  const date = formatDate(newDate)
68
- return date.getUTCMonth() +1
70
+ return date.getMonth() + 1
69
71
  }
70
72
 
71
73
  export const toYear = (newDate: Date | string, timeZone?: string): number => {
72
74
  if (timeZone) {
73
- const date = new Date(newDate.toLocaleString(undefined, { timeZone }));
74
- return date.getUTCFullYear()
75
+ const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
76
+ return date.getFullYear()
75
77
  } else {
76
- const date = new Date(newDate)
77
- return date.getUTCFullYear()
78
+ const date = formatDate(newDate)
79
+ return date.getFullYear()
78
80
  }
79
81
  }
80
82
 
81
83
  export const toTime = (newDate: Date | string, timeZone?: string): string => {
82
84
  const date = formatDate(newDate)
85
+
83
86
  if (timeZone) {
84
87
  return date.toLocaleTimeString(undefined, { timeZone, timeStyle: "short" }).split(' ')[0];
85
88
  } else {
@@ -88,21 +91,23 @@ export const toTime = (newDate: Date | string, timeZone?: string): string => {
88
91
  }
89
92
 
90
93
  export const toMeridiem = (newDate: Date | string, timeZone?: string): string => {
91
- const date = formatDate(newDate)
92
- if (timeZone) {
93
- return date.toLocaleString(undefined, { timeZone, hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
94
- } else {
95
- return date.toLocaleString(undefined, { hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
96
- }
94
+ const date = formatDate(newDate)
95
+
96
+ if (timeZone) {
97
+ return date.toLocaleString(undefined, { timeZone, hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
98
+ } else {
99
+ return date.toLocaleString(undefined, { hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
100
+ }
97
101
  }
98
102
 
99
103
  export const toTimeZone = (newDate: Date | string, timeZone?: string): string => {
100
- const date = formatDate(newDate)
101
- if (timeZone) {
102
- return date.toLocaleString(undefined, { timeZone, timeZoneName: "short" }).split(' ')[3];
103
- } else {
104
- return date.toLocaleString(undefined, { timeZoneName: "short" }).split(' ')[3];
105
- }
104
+ const date = formatDate(newDate)
105
+
106
+ if (timeZone) {
107
+ return date.toLocaleString(undefined, { timeZone, timeZoneName: "short" }).split(' ')[3];
108
+ } else {
109
+ return date.toLocaleString(undefined, { timeZoneName: "short" }).split(' ')[3];
110
+ }
106
111
  }
107
112
 
108
113
  export const toTimeWithMeridiem = (newDate: Date | string, timeZone: string): string => {
@@ -111,8 +116,8 @@ export const toTimeWithMeridiem = (newDate: Date | string, timeZone: string): st
111
116
  }
112
117
 
113
118
  export const toIso = (newDate: Date | string): string => {
114
- const date = formatDate(newDate)
115
- return date.toISOString()
119
+ const date = formatDate(newDate)
120
+ return date.toISOString()
116
121
  }
117
122
 
118
123
  export const fromNow = (newDate: Date | string): string => {