@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.
- package/dist/bundle.js +127 -115
- package/esm/core/Editor/config.js +4 -4
- package/esm/core/FileInput/index.js +2 -0
- package/esm/core/FileInput/styles.js +12 -20
- package/esm/core/NoticeCard/index.js +1 -1
- package/esm/core/NoticeCard/privateComponents/NoticeAttachmentBlock/index.js +1 -1
- package/esm/core/NoticeCard/privateComponents/NoticeMetaInfo/index.js +1 -1
- package/esm/core/NoticeCard/utils.js +2 -3
- package/esm/index.js +2 -2
- package/esm/utils/format.js +31 -13
- package/lib/core/Editor/config.d.ts +2 -2
- package/lib/core/Editor/config.js +4 -4
- package/lib/core/FileInput/index.d.ts +2 -0
- package/lib/core/FileInput/index.d.ts.map +1 -1
- package/lib/core/FileInput/index.js +2 -0
- package/lib/core/FileInput/styles.d.ts +2 -0
- package/lib/core/FileInput/styles.d.ts.map +1 -1
- package/lib/core/FileInput/styles.js +12 -20
- package/lib/core/NoticeCard/index.d.ts.map +1 -1
- package/lib/core/NoticeCard/index.js +1 -1
- package/lib/core/NoticeCard/models.d.ts +2 -0
- package/lib/core/NoticeCard/models.d.ts.map +1 -1
- package/lib/core/NoticeCard/privateComponents/NoticeAttachmentBlock/index.js +1 -1
- package/lib/core/NoticeCard/privateComponents/NoticeMetaInfo/index.d.ts.map +1 -1
- package/lib/core/NoticeCard/privateComponents/NoticeMetaInfo/index.js +1 -1
- package/lib/core/NoticeCard/utils.d.ts.map +1 -1
- package/lib/core/NoticeCard/utils.js +2 -3
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/utils/format.d.ts +12 -2
- package/lib/utils/format.d.ts.map +1 -1
- package/lib/utils/format.js +31 -13
- package/package.json +1 -1
package/lib/utils/format.js
CHANGED
@@ -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
|
-
|
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 };
|