asab_webui_components 26.1.6 → 26.1.7

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.
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.validateDateTime = validateDateTime;
7
+ // For best performance, create a regular expression only once.
8
+ var n_digits = /^\d+n$/;
7
9
  function validateDateTime(value) {
8
10
  // Return 'Invalid Date' if the input is null or undefined
9
11
  if (value == null) {
@@ -18,6 +20,15 @@ function validateDateTime(value) {
18
20
 
19
21
  // Handle string values
20
22
  if (typeof value === 'string') {
23
+ // Check if string ends with 'n' AND verify the entire string consists only of digits followed by 'n'
24
+ if (value.endsWith('n') && n_digits.test(value)) {
25
+ try {
26
+ // Remove the 'n' suffix before converting to BigInt
27
+ return splDatetimeToIso(BigInt(value.slice(0, -1)));
28
+ } catch (_unused) {
29
+ return 'Invalid Date';
30
+ }
31
+ }
21
32
  return new Date(value);
22
33
  }
23
34
 
@@ -1,3 +1,6 @@
1
+ // For best performance, create a regular expression only once.
2
+ const n_digits = /^\d+n$/;
3
+
1
4
  export function validateDateTime(value) {
2
5
  // Return 'Invalid Date' if the input is null or undefined
3
6
  if (value == null) {
@@ -12,6 +15,15 @@ export function validateDateTime(value) {
12
15
 
13
16
  // Handle string values
14
17
  if (typeof value === 'string') {
18
+ // Check if string ends with 'n' AND verify the entire string consists only of digits followed by 'n'
19
+ if (value.endsWith('n') && n_digits.test(value)) {
20
+ try {
21
+ // Remove the 'n' suffix before converting to BigInt
22
+ return splDatetimeToIso(BigInt(value.slice(0, -1)));
23
+ } catch {
24
+ return 'Invalid Date';
25
+ }
26
+ }
15
27
  return new Date(value);
16
28
  }
17
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_components",
3
- "version": "26.1.6",
3
+ "version": "26.1.7",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Components Library",
6
6
  "contributors": [