@jobber/components 4.19.0 → 4.19.2-JOB-67412.2

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.
@@ -7,7 +7,11 @@ interface FormatDateProps {
7
7
  * A `string` should be an ISO 8601 format date string.
8
8
  */
9
9
  readonly date: CivilDate | Date | string;
10
+ /**
11
+ * Boolean to show year or not.
12
+ */
13
+ readonly showYear?: boolean;
10
14
  }
11
- export declare function FormatDate({ date: inputDate }: FormatDateProps): JSX.Element;
12
- export declare function strFormatDate(date: Date): string;
15
+ export declare function FormatDate({ date: inputDate, showYear, }: FormatDateProps): JSX.Element;
16
+ export declare function strFormatDate(date: Date, showYear?: boolean): string;
13
17
  export {};
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
10
 
11
- function FormatDate({ date: inputDate }) {
11
+ function FormatDate({ date: inputDate, showYear = true, }) {
12
12
  let dateObject;
13
13
  if (inputDate instanceof Date) {
14
14
  dateObject = inputDate;
@@ -19,14 +19,17 @@ function FormatDate({ date: inputDate }) {
19
19
  else {
20
20
  dateObject = new Date(inputDate.year, inputDate.month - 1, inputDate.day);
21
21
  }
22
- return React__default["default"].createElement(React__default["default"].Fragment, null, strFormatDate(dateObject));
22
+ return React__default["default"].createElement(React__default["default"].Fragment, null, strFormatDate(dateObject, showYear));
23
23
  }
24
- function strFormatDate(date) {
25
- return date.toLocaleDateString(undefined, {
26
- year: "numeric",
24
+ function strFormatDate(date, showYear = true) {
25
+ let formatOptions = {
27
26
  month: "short",
28
27
  day: "numeric",
29
- });
28
+ };
29
+ if (showYear) {
30
+ formatOptions = Object.assign(Object.assign({}, formatOptions), { year: "numeric" });
31
+ }
32
+ return date.toLocaleDateString(undefined, formatOptions);
30
33
  }
31
34
 
32
35
  exports.FormatDate = FormatDate;
@@ -16,7 +16,7 @@ interface GridProps {
16
16
  /**
17
17
  * Array of `Grid.Cell` children
18
18
  */
19
- readonly children: Array<ReactElement<GridCellProps>>;
19
+ readonly children: Array<ReactElement<GridCellProps>> | ReactElement<GridCellProps>;
20
20
  }
21
21
  export declare const GRID_TEST_ID = "ATL-Grid";
22
22
  export declare function Grid({ alignItems, gap, children, }: GridProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.19.0",
3
+ "version": "4.19.2-JOB-67412.2+1a101ad1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@jobber/design": "^0.41.2",
23
- "@jobber/formatters": "*",
23
+ "@jobber/formatters": "^0.2.2",
24
24
  "@jobber/hooks": "^2.1.3",
25
25
  "@popperjs/core": "^2.0.6",
26
26
  "@std-proposal/temporal": "0.0.1",
@@ -83,5 +83,5 @@
83
83
  "> 1%",
84
84
  "IE 10"
85
85
  ],
86
- "gitHead": "48f00246d2f9fac845289409468e82611472c3ad"
86
+ "gitHead": "1a101ad1c9b085e05765625e0306b33842ad02cd"
87
87
  }