@salesforcedevs/dx-components 1.3.23 → 1.3.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.23",
3
+ "version": "1.3.26",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -38,5 +38,5 @@
38
38
  "eventsourcemock": "^2.0.0",
39
39
  "luxon": "^3.1.0"
40
40
  },
41
- "gitHead": "aa941f14d31057be79ae39dff3c20af85881853a"
41
+ "gitHead": "31be8a973c75cec3678c6ec7308fb6099b29d055"
42
42
  }
@@ -1,4 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import { convertForDaylightSavings } from "dxUtils/dates";
2
3
  import {
3
4
  formattedDateDay,
4
5
  formattedDateHour,
@@ -11,8 +12,6 @@ import {
11
12
  formattedDateYear
12
13
  } from "typings/custom";
13
14
 
14
- import { DateTime } from "luxon";
15
-
16
15
  export default class FormattedDateTime extends LightningElement {
17
16
  @api weekday: formattedDateWeekday;
18
17
  @api year: formattedDateYear;
@@ -29,11 +28,7 @@ export default class FormattedDateTime extends LightningElement {
29
28
  return;
30
29
  }
31
30
 
32
- this._unformattedDate = DateTime.fromISO(value)
33
- .plus({
34
- hour: 1
35
- })
36
- .toJSDate();
31
+ this._unformattedDate = convertForDaylightSavings(value).toJSDate();
37
32
 
38
33
  if (this._unformattedDate.toString() === "Invalid Date") {
39
34
  // this is a fix for Safari since it doesn't support date strings with 'yyyy/mm/dd' patterns
@@ -9,7 +9,6 @@ p,
9
9
  h2 {
10
10
  display: flex;
11
11
  flex-direction: row;
12
- padding: 0 var(--dx-c-hr-padding-horizontal);
13
12
  font-family: var(--dx-g-font-display);
14
13
  font-size: var(--dx-g-text-sm);
15
14
  color: var(--dx-g-blue-vibrant-20);
@@ -42,7 +41,6 @@ dx-button {
42
41
  display: flex;
43
42
  width: 100%;
44
43
  text-transform: capitalize;
45
- padding: 0 var(--dx-c-hr-padding-horizontal);
46
44
  }
47
45
 
48
46
  dx-button::before {
@@ -7,6 +7,7 @@ export default class Hr extends LightningElement {
7
7
  @api href?: string | null;
8
8
  @api target: string | null = "_top";
9
9
  @api spacing: string | null = "2xl";
10
+ @api noPadding: boolean = false;
10
11
  @api variant: HrVariant | null = null;
11
12
 
12
13
  private get ariaRole() {
@@ -14,9 +15,14 @@ export default class Hr extends LightningElement {
14
15
  }
15
16
 
16
17
  private get style() {
17
- return this.spacing
18
+ const spacing = this.spacing
18
19
  ? `margin: var(--dx-g-spacing-${this.spacing}) 0;`
19
20
  : "";
21
+ const padding = this.noPadding
22
+ ? ""
23
+ : "padding: 0 var(--dx-c-hr-padding-horizontal);";
24
+
25
+ return `${spacing}${padding}`;
20
26
  }
21
27
 
22
28
  private get isButtonVariant() {
@@ -1,3 +1,5 @@
1
+ import { DateTime } from "luxon";
2
+
1
3
  const MONTHS = {
2
4
  January: 0,
3
5
  February: 1,
@@ -20,7 +22,6 @@ const MONTHS = {
20
22
  "January 2022": [ *array of dates for this month* ],
21
23
  }
22
24
  */
23
-
24
25
  export function sortSplittedPostsByMonth(postsByMonth: any) {
25
26
  const sortedPostsByMonth: { [key: string]: Array<{}> } = {};
26
27
 
@@ -58,3 +59,23 @@ export function sortSplittedPostsByMonth(postsByMonth: any) {
58
59
 
59
60
  return sortedPostsByMonth;
60
61
  }
62
+
63
+ export function convertForDaylightSavings(
64
+ date: string,
65
+ zone: string = "local"
66
+ ) {
67
+ if (!hasDST(zone)) {
68
+ return DateTime.fromISO(date).setZone(zone);
69
+ }
70
+
71
+ return DateTime.fromISO(date).setZone(zone).isInDST
72
+ ? DateTime.fromISO(date).setZone(zone)
73
+ : DateTime.fromISO(date).setZone(zone).plus({ hour: 1 });
74
+ }
75
+
76
+ export function hasDST(zone: string = "local") {
77
+ return (
78
+ DateTime.fromISO("2022-01-01").setZone(zone).isInDST !==
79
+ DateTime.fromISO("2022-06-01").setZone(zone).isInDST
80
+ );
81
+ }