@bytebrand/fe-ui-core 4.2.148 → 4.2.149

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": "@bytebrand/fe-ui-core",
3
- "version": "4.2.148",
3
+ "version": "4.2.149",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -26,7 +26,6 @@ export interface IButtonProps {
26
26
  }
27
27
 
28
28
  const Button: React.FC<IButtonProps> = ({ className, color, onClick, onMouseEnter, onMouseLeave, variant, loading, disabled, children }: IButtonProps) => {
29
-
30
29
  const onHandlerClick = (event: React.MouseEvent<HTMLButtonElement>) => {
31
30
  event.stopPropagation();
32
31
  event.nativeEvent.stopImmediatePropagation();
@@ -49,7 +48,7 @@ const Button: React.FC<IButtonProps> = ({ className, color, onClick, onMouseEnte
49
48
  const props = {
50
49
  variant,
51
50
  className,
52
- color: !!color ? color : 'primary',
51
+ color,
53
52
  onClick: onHandlerClick,
54
53
  onMouseEnter: onHandlerMouseEnter,
55
54
  onMouseLeave: onHandlerMouseLeave,
@@ -584,6 +584,32 @@ export const getCents = (value: number, prefix?: string, postfix?: string): stri
584
584
  return `${prefix}${result}${postfix}`;
585
585
  };
586
586
 
587
+ /**
588
+ * Generates a timestamp (Unix time) after 14 days from the current date.
589
+ * @returns {number} Timestamp (Unix time) after 14 days.
590
+ */
591
+ export const getUnixTimestampAfterTwoWeeks = () => {
592
+ const currentDate = new Date();
593
+ const futureDate = new Date();
594
+
595
+ futureDate.setDate(currentDate.getDate() + 14);
596
+
597
+ const unixTimestamp = Math.floor(futureDate.getTime() / 1000);
598
+ return unixTimestamp;
599
+ };
600
+
601
+ /**
602
+ * Converts a Unix timestamp to the day of the month.
603
+ * @param {number} unixTimestamp - The Unix timestamp to convert.
604
+ * @returns {number} The day of the month.
605
+ */
606
+ export const convertUnixTimestampToDays = (unixTimestamp: number) => {
607
+ const milliseconds = unixTimestamp * 1000;
608
+ const date = new Date(milliseconds);
609
+ const day = date.getDate();
610
+ return day;
611
+ };
612
+
587
613
  export const priceParse = (value: any) => {
588
614
  return !!value ? Number.parseFloat(value) : null;
589
615
  };
package/utils.ts CHANGED
@@ -37,6 +37,8 @@ export {
37
37
  buildQueryForSearch,
38
38
  buildBodyForRequest,
39
39
  priceParse,
40
+ getUnixTimestampAfterTwoWeeks,
41
+ convertUnixTimestampToDays,
40
42
  getCents
41
43
  } from './source/framework/utils/CommonUtils';
42
44