asab_webui_components 25.2.3 → 25.2.4

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.
@@ -20,7 +20,7 @@ function DateTime(props) {
20
20
  if (new Date(props.value).toString() === 'Invalid Date') {
21
21
  return /*#__PURE__*/_react["default"].createElement(InvalidDate, null);
22
22
  }
23
- var date = (0, _timeToString["default"])(props.value, props.dateTimeFormat);
23
+ var date = (0, _timeToString["default"])(props.value, props.dateTimeFormat, locale);
24
24
 
25
25
  // Check for invalid date from timeToString method
26
26
  if (date === 'Invalid Date') {
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports["default"] = void 0;
8
7
  var _dateFns = require("date-fns");
9
- var _useDateFNSLocale = _interopRequireDefault(require("./useDateFNSLocale"));
10
8
  var timeToString = function timeToString(value) {
11
9
  var dateTimeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "medium";
10
+ var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
12
11
  if (value == undefined) {
13
12
  return 'Invalid Date';
14
13
  }
@@ -30,13 +29,13 @@ var timeToString = function timeToString(value) {
30
29
  if ((0, _dateFns.parseISO)(value) == "Invalid Date") {
31
30
  return 'Invalid Date';
32
31
  } else {
33
- date = formatDate((0, _dateFns.parseISO)(value), dateTimeFormat);
32
+ date = formatDate((0, _dateFns.parseISO)(value), dateTimeFormat, locale);
34
33
  }
35
34
  } else {
36
35
  if (value > 9999999999) {
37
- date = formatDate(value, dateTimeFormat);
36
+ date = formatDate(value, dateTimeFormat, locale);
38
37
  } else {
39
- date = formatDate(value * 1000, dateTimeFormat);
38
+ date = formatDate(value * 1000, dateTimeFormat, locale);
40
39
  }
41
40
  }
42
41
  return {
@@ -44,8 +43,7 @@ var timeToString = function timeToString(value) {
44
43
  distanceToNow: date.distanceToNow
45
44
  };
46
45
  };
47
- var formatDate = function formatDate(value, dateTimeFormat) {
48
- var locale = (0, _useDateFNSLocale["default"])();
46
+ var formatDate = function formatDate(value, dateTimeFormat, locale) {
49
47
  switch (dateTimeFormat) {
50
48
  case "long":
51
49
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_components",
3
- "version": "25.2.3",
3
+ "version": "25.2.4",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Components Library",
6
6
  "contributors": [