@bbl-digital/snorre 2.2.43 → 2.2.47

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.
Files changed (34) hide show
  1. package/dist/bundle.js +127 -115
  2. package/esm/core/Editor/config.js +4 -4
  3. package/esm/core/FileInput/index.js +2 -0
  4. package/esm/core/FileInput/styles.js +12 -20
  5. package/esm/core/NoticeCard/index.js +1 -1
  6. package/esm/core/NoticeCard/privateComponents/NoticeAttachmentBlock/index.js +1 -1
  7. package/esm/core/NoticeCard/privateComponents/NoticeMetaInfo/index.js +1 -1
  8. package/esm/core/NoticeCard/utils.js +2 -3
  9. package/esm/index.js +2 -2
  10. package/esm/utils/format.js +31 -13
  11. package/lib/core/Editor/config.d.ts +2 -2
  12. package/lib/core/Editor/config.js +4 -4
  13. package/lib/core/FileInput/index.d.ts +2 -0
  14. package/lib/core/FileInput/index.d.ts.map +1 -1
  15. package/lib/core/FileInput/index.js +2 -0
  16. package/lib/core/FileInput/styles.d.ts +2 -0
  17. package/lib/core/FileInput/styles.d.ts.map +1 -1
  18. package/lib/core/FileInput/styles.js +12 -20
  19. package/lib/core/NoticeCard/index.d.ts.map +1 -1
  20. package/lib/core/NoticeCard/index.js +1 -1
  21. package/lib/core/NoticeCard/models.d.ts +2 -0
  22. package/lib/core/NoticeCard/models.d.ts.map +1 -1
  23. package/lib/core/NoticeCard/privateComponents/NoticeAttachmentBlock/index.js +1 -1
  24. package/lib/core/NoticeCard/privateComponents/NoticeMetaInfo/index.d.ts.map +1 -1
  25. package/lib/core/NoticeCard/privateComponents/NoticeMetaInfo/index.js +1 -1
  26. package/lib/core/NoticeCard/utils.d.ts.map +1 -1
  27. package/lib/core/NoticeCard/utils.js +2 -3
  28. package/lib/index.d.ts +2 -2
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +2 -2
  31. package/lib/utils/format.d.ts +12 -2
  32. package/lib/utils/format.d.ts.map +1 -1
  33. package/lib/utils/format.js +31 -13
  34. package/package.json +1 -1
@@ -1,3 +1,8 @@
1
+ import { ddmmyyyy } from './dates';
2
+ /**
3
+ * PRICES
4
+ */
5
+
1
6
  const getFormattedPrice = (price, decimals, roundDown) => {
2
7
  if (isNaN(price)) {
3
8
  return price;
@@ -20,6 +25,18 @@ const getFormattedPrice = (price, decimals, roundDown) => {
20
25
  return decimals ? formatted : formatted.replace(/,/g, '.');
21
26
  };
22
27
 
28
+ const getPriceWithLabel = pricing => {
29
+ return `${getPriceLabel(pricing)} ${getFormattedPriceWithEnding(getPrice(pricing))}`;
30
+ };
31
+
32
+ const getPriceLabel = pricing => {
33
+ return pricing.fixedPrice ? 'Fastpris' : 'Prisantydning';
34
+ };
35
+
36
+ const getPrice = pricing => {
37
+ return pricing.fixedPrice ? pricing.fixedPrice : pricing.askingPrice;
38
+ };
39
+
23
40
  const getFormattedPriceWithEnding = (price, decimals) => {
24
41
  if (price === undefined || price === null) {
25
42
  return 'Ikke angitt';
@@ -28,6 +45,10 @@ const getFormattedPriceWithEnding = (price, decimals) => {
28
45
  const formattedPrice = getFormattedPrice(price, decimals);
29
46
  return formattedPrice + ' kr';
30
47
  };
48
+ /**
49
+ * DATES
50
+ */
51
+
31
52
 
32
53
  const getFormattedDate = (date, opt) => {
33
54
  const options = opt || {
@@ -46,6 +67,15 @@ const getFormattedTime = date => {
46
67
  return (parsedDate.getHours() < 10 ? '0' : '') + parsedDate.getHours() + ':' + (parsedDate.getMinutes() < 10 ? '0' : '') + parsedDate.getMinutes();
47
68
  };
48
69
 
70
+ const getFormattedDateTimePretty = (date, opt = ddmmyyyy) => {
71
+ if (!date) return '';
72
+ return `${getFormattedDate(date, opt)} kl ${getFormattedTime(date)}`;
73
+ };
74
+ /**
75
+ * OTHERS
76
+ */
77
+
78
+
49
79
  const getTitleString = text => {
50
80
  if (!text) return '';
51
81
  text = text.toLowerCase();
@@ -65,10 +95,6 @@ const getFormattedCardNumber = cardNumber => {
65
95
  return formatted;
66
96
  };
67
97
 
68
- const getPriceWithLabel = pricing => {
69
- return `${getPriceLabel(pricing)} ${getFormattedPriceWithEnding(getPrice(pricing))}`;
70
- };
71
-
72
98
  const getFormattedOrganizationNumber = organizationNumber => {
73
99
  let org = String(organizationNumber);
74
100
  if (!org) return '';
@@ -76,12 +102,4 @@ const getFormattedOrganizationNumber = organizationNumber => {
76
102
  return org.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
77
103
  };
78
104
 
79
- const getPriceLabel = pricing => {
80
- return pricing.fixedPrice ? 'Fastpris' : 'Prisantydning';
81
- };
82
-
83
- const getPrice = pricing => {
84
- return pricing.fixedPrice ? pricing.fixedPrice : pricing.askingPrice;
85
- };
86
-
87
- export { getFormattedOrganizationNumber, getFormattedPrice, getFormattedPriceWithEnding, getFormattedDate, getTitleString, getFormattedCardNumber, getFormattedTime, getPriceWithLabel };
105
+ export { getFormattedOrganizationNumber, getFormattedPrice, getFormattedPriceWithEnding, getFormattedDate, getTitleString, getFormattedCardNumber, getFormattedTime, getPriceWithLabel, getFormattedDateTimePretty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.2.43",
3
+ "version": "2.2.47",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",