@bbl-digital/snorre 2.4.42 → 2.4.43

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -761,7 +761,6 @@
761
761
  };
762
762
 
763
763
  const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'];
764
-
765
764
  const parseDate = (date, format, locale, minDate, maxDate) => {
766
765
  const format1 = (date.length === 10 || date.length === 8) && date.includes('.');
767
766
  const format2 = (date.length === 6 || date.length === 8) && !date.includes('.');
@@ -804,7 +803,6 @@
804
803
 
805
804
  return rest;
806
805
  };
807
-
808
806
  const getDateIsValid = (date, minDate, maxDate) => {
809
807
  if (!date) return false;
810
808
  const min = minDate ? new Date(minDate) : null;
@@ -816,7 +814,6 @@
816
814
  if (!(min || max)) return true;
817
815
  return (!min || min && date >= min) && (!max || max && date <= max);
818
816
  };
819
-
820
817
  const datesAreOnSameDay = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();
821
818
  const ddmmyyyy = {
822
819
  day: '2-digit',
@@ -25962,6 +25959,8 @@
25962
25959
  }, [isOpen, pickerRef, popperElement]);
25963
25960
 
25964
25961
  const emitChange = newDate => {
25962
+ newDate.setHours(12, 0); // To avoid timezone issues
25963
+
25965
25964
  setDate(newDate);
25966
25965
  onChange(newDate);
25967
25966
  };
@@ -69,6 +69,8 @@ const Datepicker = ({
69
69
  }, [isOpen, pickerRef, popperElement]);
70
70
 
71
71
  const emitChange = newDate => {
72
+ newDate.setHours(12, 0); // To avoid timezone issues
73
+
72
74
  setDate(newDate);
73
75
  onChange(newDate);
74
76
  };
@@ -1,9 +1,5 @@
1
- const MONTHS = ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'];
2
- const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'];
3
- const WEEKDAYS_LONG = ['Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag', 'Søndag'];
4
- const WEEKDAYS_SHORT = ['S', 'M', 'T', 'O', 'T', 'F', 'L'];
5
-
6
- const parseDate = (date, format, locale, minDate, maxDate) => {
1
+ export const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'];
2
+ export const parseDate = (date, format, locale, minDate, maxDate) => {
7
3
  const format1 = (date.length === 10 || date.length === 8) && date.includes('.');
8
4
  const format2 = (date.length === 6 || date.length === 8) && !date.includes('.');
9
5
 
@@ -45,8 +41,7 @@ const parseDate = (date, format, locale, minDate, maxDate) => {
45
41
 
46
42
  return rest;
47
43
  };
48
-
49
- const formatDate = (date, format, locale) => {
44
+ export const formatDate = (date, format, locale) => {
50
45
  const options = {
51
46
  day: '2-digit',
52
47
  month: '2-digit',
@@ -54,8 +49,7 @@ const formatDate = (date, format, locale) => {
54
49
  };
55
50
  return new Intl.DateTimeFormat(['no-NO', 'nb-NO', 'nn-NO', 'de-DE'], options).format(new Date(date));
56
51
  };
57
-
58
- const getDateIsValid = (date, minDate, maxDate) => {
52
+ export const getDateIsValid = (date, minDate, maxDate) => {
59
53
  if (!date) return false;
60
54
  const min = minDate ? new Date(minDate) : null;
61
55
  const max = maxDate ? new Date(maxDate) : null;
@@ -66,9 +60,8 @@ const getDateIsValid = (date, minDate, maxDate) => {
66
60
  if (!(min || max)) return true;
67
61
  return (!min || min && date >= min) && (!max || max && date <= max);
68
62
  };
69
-
70
63
  export const datesAreOnSameDay = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();
71
- const ddmmyyyy = {
64
+ export const ddmmyyyy = {
72
65
  day: '2-digit',
73
66
  month: '2-digit',
74
67
  year: 'numeric'
@@ -88,8 +81,7 @@ export const mmyyyy = {
88
81
  month: '2-digit',
89
82
  year: 'numeric'
90
83
  };
91
- const hhmm = {
84
+ export const hhmm = {
92
85
  hour: '2-digit',
93
86
  minute: '2-digit'
94
- };
95
- export { MONTHS, MONTHS_SHORT, WEEKDAYS_LONG, WEEKDAYS_SHORT, parseDate, formatDate, getDateIsValid, ddmmyyyy, hhmm };
87
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Datepicker/index.tsx"],"names":[],"mappings":"AACA,sCAAsC;AACtC,OAAO,KAAsC,MAAM,OAAO,CAAA;AAW1D,UAAU,MAAM;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uCAAuC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAA;IAC/B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAID,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CA+LhC,CAAA;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Datepicker/index.tsx"],"names":[],"mappings":"AACA,sCAAsC;AACtC,OAAO,KAAsC,MAAM,OAAO,CAAA;AAW1D,UAAU,MAAM;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uCAAuC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAA;IAC/B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAID,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAgMhC,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -69,6 +69,8 @@ const Datepicker = ({
69
69
  }, [isOpen, pickerRef, popperElement]);
70
70
 
71
71
  const emitChange = newDate => {
72
+ newDate.setHours(12, 0); // To avoid timezone issues
73
+
72
74
  setDate(newDate);
73
75
  onChange(newDate);
74
76
  };
@@ -1,16 +1,12 @@
1
- declare const MONTHS: string[];
2
- declare const MONTHS_SHORT: string[];
3
- declare const WEEKDAYS_LONG: string[];
4
- declare const WEEKDAYS_SHORT: string[];
5
- declare const parseDate: (date: string, format?: string | undefined, locale?: string | undefined, minDate?: string | Date | undefined, maxDate?: string | Date | undefined) => Date | undefined;
6
- declare const formatDate: (date: Date, format: string, locale: string) => string;
7
- declare const getDateIsValid: (date: Date | string, minDate?: string | Date | undefined, maxDate?: string | Date | undefined) => boolean;
1
+ export declare const MONTHS_SHORT: string[];
2
+ export declare const parseDate: (date: string, format?: string | undefined, locale?: string | undefined, minDate?: string | Date | undefined, maxDate?: string | Date | undefined) => Date | undefined;
3
+ export declare const formatDate: (date: Date, format: string, locale: string) => string;
4
+ export declare const getDateIsValid: (date: Date | string, minDate?: string | Date | undefined, maxDate?: string | Date | undefined) => boolean;
8
5
  export declare const datesAreOnSameDay: (first: Date, second: Date) => boolean;
9
- declare const ddmmyyyy: Intl.DateTimeFormatOptions;
6
+ export declare const ddmmyyyy: Intl.DateTimeFormatOptions;
10
7
  export declare const ddMM: Intl.DateTimeFormatOptions;
11
8
  export declare const MM: Intl.DateTimeFormatOptions;
12
9
  export declare const mmYYYY: Intl.DateTimeFormatOptions;
13
10
  export declare const mmyyyy: Intl.DateTimeFormatOptions;
14
- declare const hhmm: Intl.DateTimeFormatOptions;
15
- export { MONTHS, MONTHS_SHORT, WEEKDAYS_LONG, WEEKDAYS_SHORT, parseDate, formatDate, getDateIsValid, ddmmyyyy, hhmm, };
11
+ export declare const hhmm: Intl.DateTimeFormatOptions;
16
12
  //# sourceMappingURL=dates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/packages/utils/dates.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,UAaX,CAAA;AACD,QAAA,MAAM,YAAY,UAajB,CAAA;AACD,QAAA,MAAM,aAAa,UAQlB,CAAA;AACD,QAAA,MAAM,cAAc,UAAsC,CAAA;AAE1D,QAAA,MAAM,SAAS,SACP,MAAM,yJAgDb,CAAA;AAED,QAAA,MAAM,UAAU,SAAU,IAAI,UAAU,MAAM,UAAU,MAAM,WAW7D,CAAA;AAED,QAAA,MAAM,cAAc,SACZ,IAAI,GAAG,MAAM,sFAgBpB,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,IAAI,UAAU,IAAI,YAGrB,CAAA;AAEtC,QAAA,MAAM,QAAQ,EAAE,IAAI,CAAC,qBAIpB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,qBAGvB,CAAA;AAED,eAAO,MAAM,EAAE,EAAE,IAAI,CAAC,qBAErB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,qBAGzB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,qBAGzB,CAAA;AAED,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,qBAGhB,CAAA;AAED,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,IAAI,GACL,CAAA"}
1
+ {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/packages/utils/dates.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAaxB,CAAA;AAED,eAAO,MAAM,SAAS,SACd,MAAM,yJAgDb,CAAA;AAED,eAAO,MAAM,UAAU,SAAU,IAAI,UAAU,MAAM,UAAU,MAAM,WAWpE,CAAA;AAED,eAAO,MAAM,cAAc,SACnB,IAAI,GAAG,MAAM,sFAgBpB,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,IAAI,UAAU,IAAI,YAGrB,CAAA;AAEtC,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,qBAI3B,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,qBAGvB,CAAA;AAED,eAAO,MAAM,EAAE,EAAE,IAAI,CAAC,qBAErB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,qBAGzB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,qBAGzB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,qBAGvB,CAAA"}
@@ -1,9 +1,5 @@
1
- const MONTHS = ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'];
2
- const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'];
3
- const WEEKDAYS_LONG = ['Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag', 'Søndag'];
4
- const WEEKDAYS_SHORT = ['S', 'M', 'T', 'O', 'T', 'F', 'L'];
5
-
6
- const parseDate = (date, format, locale, minDate, maxDate) => {
1
+ export const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'];
2
+ export const parseDate = (date, format, locale, minDate, maxDate) => {
7
3
  const format1 = (date.length === 10 || date.length === 8) && date.includes('.');
8
4
  const format2 = (date.length === 6 || date.length === 8) && !date.includes('.');
9
5
 
@@ -45,8 +41,7 @@ const parseDate = (date, format, locale, minDate, maxDate) => {
45
41
 
46
42
  return rest;
47
43
  };
48
-
49
- const formatDate = (date, format, locale) => {
44
+ export const formatDate = (date, format, locale) => {
50
45
  const options = {
51
46
  day: '2-digit',
52
47
  month: '2-digit',
@@ -54,8 +49,7 @@ const formatDate = (date, format, locale) => {
54
49
  };
55
50
  return new Intl.DateTimeFormat(['no-NO', 'nb-NO', 'nn-NO', 'de-DE'], options).format(new Date(date));
56
51
  };
57
-
58
- const getDateIsValid = (date, minDate, maxDate) => {
52
+ export const getDateIsValid = (date, minDate, maxDate) => {
59
53
  if (!date) return false;
60
54
  const min = minDate ? new Date(minDate) : null;
61
55
  const max = maxDate ? new Date(maxDate) : null;
@@ -66,9 +60,8 @@ const getDateIsValid = (date, minDate, maxDate) => {
66
60
  if (!(min || max)) return true;
67
61
  return (!min || min && date >= min) && (!max || max && date <= max);
68
62
  };
69
-
70
63
  export const datesAreOnSameDay = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();
71
- const ddmmyyyy = {
64
+ export const ddmmyyyy = {
72
65
  day: '2-digit',
73
66
  month: '2-digit',
74
67
  year: 'numeric'
@@ -88,8 +81,7 @@ export const mmyyyy = {
88
81
  month: '2-digit',
89
82
  year: 'numeric'
90
83
  };
91
- const hhmm = {
84
+ export const hhmm = {
92
85
  hour: '2-digit',
93
86
  minute: '2-digit'
94
- };
95
- export { MONTHS, MONTHS_SHORT, WEEKDAYS_LONG, WEEKDAYS_SHORT, parseDate, formatDate, getDateIsValid, ddmmyyyy, hhmm };
87
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.4.42",
3
+ "version": "2.4.43",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",