@rocketlink/crm-model 1.0.127 → 1.0.129

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.
@@ -0,0 +1,5 @@
1
+ import { PaginatedRequest } from "./common/paginated.request.dto";
2
+ export interface JobsRequest extends PaginatedRequest {
3
+ id?: string;
4
+ }
5
+ //# sourceMappingURL=job.request.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.request.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/job.request.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from './dtos/field.request.dto';
16
16
  export * from './dtos/hook.request.dto';
17
17
  export * from './dtos/hookProfile.request.dto';
18
18
  export * from './dtos/hookOutbox.request.dto';
19
+ export * from './dtos/job.request.dto';
19
20
  export * from './dtos/lead.request.dto';
20
21
  export * from './dtos/mid.request.dto';
21
22
  export * from './dtos/adapter.request.dto';
@@ -35,6 +36,7 @@ export * from './model/field.model';
35
36
  export * from './model/gateway.model';
36
37
  export * from './model/hook.model';
37
38
  export * from './model/hookOutbox.model';
39
+ export * from './model/job.model';
38
40
  export * from './model/hookProfile.model';
39
41
  export * from './model/lead.model';
40
42
  export * from './model/mid.model';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7G,cAAc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AAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AAGjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,wDAAwD,CAAC;AAGvE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,8CAA8C,CAAC"}
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __exportStar(require("./dtos/field.request.dto"), exports);
41
41
  __exportStar(require("./dtos/hook.request.dto"), exports);
42
42
  __exportStar(require("./dtos/hookProfile.request.dto"), exports);
43
43
  __exportStar(require("./dtos/hookOutbox.request.dto"), exports);
44
+ __exportStar(require("./dtos/job.request.dto"), exports);
44
45
  __exportStar(require("./dtos/lead.request.dto"), exports);
45
46
  __exportStar(require("./dtos/mid.request.dto"), exports);
46
47
  __exportStar(require("./dtos/adapter.request.dto"), exports);
@@ -62,6 +63,7 @@ __exportStar(require("./model/field.model"), exports);
62
63
  __exportStar(require("./model/gateway.model"), exports);
63
64
  __exportStar(require("./model/hook.model"), exports);
64
65
  __exportStar(require("./model/hookOutbox.model"), exports);
66
+ __exportStar(require("./model/job.model"), exports);
65
67
  __exportStar(require("./model/hookProfile.model"), exports);
66
68
  __exportStar(require("./model/lead.model"), exports);
67
69
  __exportStar(require("./model/mid.model"), exports);
@@ -1,3 +1,4 @@
1
+ import type { Campaign } from './campaign.model';
1
2
  export declare const HOOK_OUTBOX_STATUS: {
2
3
  PENDING: string;
3
4
  SENT: string;
@@ -8,6 +9,7 @@ export interface HookOutbox {
8
9
  id?: number;
9
10
  hookId?: number;
10
11
  campaignId?: number;
12
+ campaign?: Campaign;
11
13
  triggerId?: string;
12
14
  hookUrl?: string;
13
15
  payloadJson?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"hookOutbox.model.d.ts","sourceRoot":"","sources":["../../src/model/hookOutbox.model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
1
+ {"version":3,"file":"hookOutbox.model.d.ts","sourceRoot":"","sources":["../../src/model/hookOutbox.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,6 @@
1
+ export interface Job {
2
+ id?: string | number;
3
+ createdAt?: Date;
4
+ updatedAt?: Date;
5
+ }
6
+ //# sourceMappingURL=job.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.model.d.ts","sourceRoot":"","sources":["../../src/model/job.model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -30,9 +30,8 @@ export declare function addDaysToDateString(value: string, days: number, formatS
30
30
  export declare function subtractDaysFromDateString(value: string, days: number, formatString?: string): string;
31
31
  export declare function addMonthsToDate(date: Date, months: number): Date;
32
32
  export declare function addPeriodToDate(date: Date, period: number, unit: INTERVAL_UNIT): Date;
33
- export type UiDateInput = Date | string;
34
33
  export type FormatDateForUiOptions = {
35
34
  includeSeconds?: boolean;
36
35
  };
37
- export declare function formatDateForUi(value: UiDateInput | null | undefined, options?: FormatDateForUiOptions): string;
36
+ export declare function formatDateForUi(value: string | Date | null | undefined, options?: FormatDateForUiOptions): string;
38
37
  //# sourceMappingURL=dateUtil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateUtil.d.ts","sourceRoot":"","sources":["../../src/util/dateUtil.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO;;;;;;;CAOV,CAAC;AAEX,eAAO,MAAM,aAAa;;;CAGhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAK/E,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,GAAE,MAAyB,GAAG,MAAM,CAKzF;AAED,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAElD;AAED,wBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAEjD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAExD;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnD;AAKD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAShD;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAyB,GAAG,MAAM,CAM/F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,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G,MAAM,CAIhH;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,GAAE,MAAyB,GAAG,MAAM,CAIvH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAUrF;AAMD,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EACvC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAgDR"}
@@ -141,74 +141,51 @@ function addPeriodToDate(date, period, unit) {
141
141
  }
142
142
  return date;
143
143
  }
144
- //"15 Jan 2024, 10:30:40" or "15 Jan 2024, 10:30" or just "15 Jan 2024".
145
- const parseUiDate = (value) => {
146
- if (value instanceof Date) {
147
- const d = value;
148
- if (Number.isNaN(d.getTime()))
149
- return null;
150
- const hasTime = d.getHours() !== 0 ||
151
- d.getMinutes() !== 0 ||
152
- d.getSeconds() !== 0 ||
153
- d.getMilliseconds() !== 0;
154
- return { date: d, hasTime };
155
- }
156
- const raw = String(value).trim();
157
- if (!raw)
158
- return null;
159
- // Explicit "dd.MM.yyyy" (e.g. "31.07.2024") -> date-only
160
- const dotDateMatch = raw.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
161
- if (dotDateMatch) {
162
- const [, dd, mm, yyyy] = dotDateMatch;
163
- const d = new Date(Number(yyyy), Number(mm) - 1, Number(dd));
164
- if (Number.isNaN(d.getTime()))
165
- return null;
166
- return { date: d, hasTime: false };
167
- }
168
- // Plain ISO date "YYYY-MM-DD" -> date-only
169
- const isoDateOnlyMatch = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
170
- if (isoDateOnlyMatch) {
171
- const [, yyyy, mm, dd] = isoDateOnlyMatch;
172
- const d = new Date(Number(yyyy), Number(mm) - 1, Number(dd));
173
- if (Number.isNaN(d.getTime()))
174
- return null;
175
- return { date: d, hasTime: false };
176
- }
177
- // Fallback to native parser for ISO timestamps and other formats.
178
- const d = new Date(raw);
179
- if (Number.isNaN(d.getTime()))
180
- return null;
181
- // If the original string clearly contained a time (has 'T' or an HH:MM),
182
- // treat it as having a time component, otherwise fall back to midnight check.
183
- const explicitTime = /T\d\d?:\d\d/.test(raw) || /\d{1,2}:\d{2}/.test(raw);
184
- const hasTime = explicitTime ||
185
- d.getHours() !== 0 ||
186
- d.getMinutes() !== 0 ||
187
- d.getSeconds() !== 0 ||
188
- d.getMilliseconds() !== 0;
189
- return { date: d, hasTime };
190
- };
191
144
  function formatDateForUi(value, options) {
192
- if (!value) {
145
+ if (!value)
193
146
  return '-';
194
- }
195
- const parsed = parseUiDate(value);
196
- if (!parsed) {
197
- return '-';
198
- }
199
- const { date, hasTime } = parsed;
200
- const includeSeconds = options?.includeSeconds ?? false;
201
- const day = String(date.getDate()).padStart(2, '0');
202
- const monthShort = date.toLocaleString('en-US', { month: 'short' });
203
- const year = date.getFullYear();
204
- const base = `${day} ${monthShort} ${year}`;
205
- if (!hasTime) {
147
+ let date;
148
+ let hasTime = false;
149
+ let hasSeconds = false;
150
+ if (value instanceof Date) {
151
+ if (!(0, date_fns_1.isValid)(value))
152
+ return '-';
153
+ date = value;
154
+ hasSeconds = value.getSeconds() !== 0;
155
+ hasTime =
156
+ value.getHours() !== 0 ||
157
+ value.getMinutes() !== 0 ||
158
+ hasSeconds;
159
+ }
160
+ else {
161
+ const raw = value.trim();
162
+ if (!raw)
163
+ return '-';
164
+ // dd.MM.yy or dd.MM.yyyy
165
+ const dot = raw.match(/^(\d{2})\.(\d{2})\.(\d{2}|\d{4})$/);
166
+ if (dot) {
167
+ const [, dd, mm, yy] = dot;
168
+ const year = yy.length === 2 ? 2000 + Number(yy) : Number(yy);
169
+ date = new Date(year, Number(mm) - 1, Number(dd));
170
+ if (!(0, date_fns_1.isValid)(date))
171
+ return '-';
172
+ }
173
+ else {
174
+ // normalize "YYYY-MM-DD HH:mm[:ss]" → ISO
175
+ const normalized = raw.replace(' ', 'T');
176
+ date = new Date(normalized);
177
+ if (!(0, date_fns_1.isValid)(date))
178
+ return '-';
179
+ hasTime = /\d{1,2}:\d{2}/.test(raw);
180
+ hasSeconds = /\d{1,2}:\d{2}:\d{2}/.test(raw);
181
+ }
182
+ }
183
+ const base = `${(0, date_fns_1.format)(date, 'dd')} ${date.toLocaleString('en-US', {
184
+ month: 'short',
185
+ })} ${(0, date_fns_1.format)(date, 'yyyy')}`;
186
+ if (!hasTime)
206
187
  return base;
207
- }
208
- const hours = String(date.getHours()).padStart(2, '0');
209
- const minutes = String(date.getMinutes()).padStart(2, '0');
210
- const time = includeSeconds
211
- ? `${hours}:${minutes}:${String(date.getSeconds()).padStart(2, '0')}`
212
- : `${hours}:${minutes}`;
188
+ const showSeconds = options?.includeSeconds ?? false;
189
+ const time = (0, date_fns_1.format)(date, showSeconds ? 'HH:mm:ss' : 'HH:mm');
213
190
  return `${base}, ${time}`;
214
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketlink/crm-model",
3
- "version": "1.0.127",
3
+ "version": "1.0.129",
4
4
  "description": "Shared DTOs and Models for CRM Rocketlink",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,5 @@
1
+ import { PaginatedRequest } from "./common/paginated.request.dto";
2
+
3
+ export interface JobsRequest extends PaginatedRequest {
4
+ id?: string;
5
+ }
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from './dtos/field.request.dto';
20
20
  export * from './dtos/hook.request.dto';
21
21
  export * from './dtos/hookProfile.request.dto';
22
22
  export * from './dtos/hookOutbox.request.dto';
23
+ export * from './dtos/job.request.dto';
23
24
  export * from './dtos/lead.request.dto';
24
25
  export * from './dtos/mid.request.dto';
25
26
  export * from './dtos/adapter.request.dto';
@@ -42,6 +43,7 @@ export * from './model/field.model';
42
43
  export * from './model/gateway.model';
43
44
  export * from './model/hook.model';
44
45
  export * from './model/hookOutbox.model';
46
+ export * from './model/job.model';
45
47
  export * from './model/hookProfile.model';
46
48
  export * from './model/lead.model';
47
49
  export * from './model/mid.model';
@@ -69,4 +71,4 @@ export * from './gateways/adapters/dtos/transaction-finxp.request.dto';
69
71
  export * from './gateways/providers/model/genesis.constants';
70
72
  export * from './gateways/providers/model/genesis.model';
71
73
  export * from './gateways/providers/model/novalNetManual.model';
72
- export * from './gateways/providers/model/finXpManual.model';
74
+ export * from './gateways/providers/model/finXpManual.model';
@@ -1,4 +1,5 @@
1
- export const HOOK_OUTBOX_STATUS = {
1
+ import type { Campaign } from './campaign.model'
2
+ export const HOOK_OUTBOX_STATUS = {
2
3
  PENDING: 'PENDING',
3
4
  SENT: 'SENT',
4
5
  FAILED: 'FAILED'
@@ -9,8 +10,9 @@ export interface HookOutbox {
9
10
  id?: number;
10
11
  hookId?: number;
11
12
  campaignId?: number;
13
+ campaign?: Campaign;
12
14
  triggerId?: string;
13
- hookUrl?: string;
15
+ hookUrl?: string;
14
16
  payloadJson?: string;
15
17
  status?: HOOK_OUTBOX_STATUS;
16
18
  statusDescription?: string;
@@ -0,0 +1,5 @@
1
+ export interface Job {
2
+ id?: string | number;
3
+ createdAt?: Date;
4
+ updatedAt?: Date;
5
+ }
@@ -142,97 +142,61 @@ export function addPeriodToDate(date: Date, period: number, unit: INTERVAL_UNIT)
142
142
 
143
143
  // ============================================
144
144
  // UI-friendly formatting (used by admin-ts)
145
+ // "15 Jan 2024, 10:30:40" or "15 Jan 2024, 10:30" or just "15 Jan 2024".
145
146
  // ============================================
146
-
147
- export type UiDateInput = Date | string;
148
-
149
- //"15 Jan 2024, 10:30:40" or "15 Jan 2024, 10:30" or just "15 Jan 2024".
150
-
151
- const parseUiDate = (
152
- value: UiDateInput
153
- ): { date: Date; hasTime: boolean } | null => {
154
- if (value instanceof Date) {
155
- const d = value;
156
- if (Number.isNaN(d.getTime())) return null;
157
- const hasTime =
158
- d.getHours() !== 0 ||
159
- d.getMinutes() !== 0 ||
160
- d.getSeconds() !== 0 ||
161
- d.getMilliseconds() !== 0;
162
- return { date: d, hasTime };
163
- }
164
-
165
- const raw = String(value).trim();
166
- if (!raw) return null;
167
-
168
- // Explicit "dd.MM.yyyy" (e.g. "31.07.2024") -> date-only
169
- const dotDateMatch = raw.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
170
- if (dotDateMatch) {
171
- const [, dd, mm, yyyy] = dotDateMatch;
172
- const d = new Date(Number(yyyy), Number(mm) - 1, Number(dd));
173
- if (Number.isNaN(d.getTime())) return null;
174
- return { date: d, hasTime: false };
175
- }
176
-
177
- // Plain ISO date "YYYY-MM-DD" -> date-only
178
- const isoDateOnlyMatch = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
179
- if (isoDateOnlyMatch) {
180
- const [, yyyy, mm, dd] = isoDateOnlyMatch;
181
- const d = new Date(Number(yyyy), Number(mm) - 1, Number(dd));
182
- if (Number.isNaN(d.getTime())) return null;
183
- return { date: d, hasTime: false };
184
- }
185
-
186
- // Fallback to native parser for ISO timestamps and other formats.
187
- const d = new Date(raw);
188
- if (Number.isNaN(d.getTime())) return null;
189
-
190
- // If the original string clearly contained a time (has 'T' or an HH:MM),
191
- // treat it as having a time component, otherwise fall back to midnight check.
192
- const explicitTime = /T\d\d?:\d\d/.test(raw) || /\d{1,2}:\d{2}/.test(raw);
193
- const hasTime =
194
- explicitTime ||
195
- d.getHours() !== 0 ||
196
- d.getMinutes() !== 0 ||
197
- d.getSeconds() !== 0 ||
198
- d.getMilliseconds() !== 0;
199
-
200
- return { date: d, hasTime };
147
+ export type FormatDateForUiOptions = {
148
+ includeSeconds?: boolean;
201
149
  };
202
150
 
203
- export type FormatDateForUiOptions = { includeSeconds?: boolean };
204
-
205
151
  export function formatDateForUi(
206
- value: UiDateInput | null | undefined,
152
+ value: string | Date | null | undefined,
207
153
  options?: FormatDateForUiOptions
208
154
  ): string {
209
- if (!value) {
210
- return '-';
211
- }
155
+ if (!value) return '-';
212
156
 
213
- const parsed = parseUiDate(value);
214
- if (!parsed) {
215
- return '-';
216
- }
157
+ let date: Date;
158
+ let hasTime = false;
159
+ let hasSeconds = false;
217
160
 
218
- const { date, hasTime } = parsed;
219
- const includeSeconds = options?.includeSeconds ?? false;
161
+ if (value instanceof Date) {
162
+ if (!isValid(value)) return '-';
163
+ date = value;
164
+
165
+ hasSeconds = value.getSeconds() !== 0;
166
+ hasTime =
167
+ value.getHours() !== 0 ||
168
+ value.getMinutes() !== 0 ||
169
+ hasSeconds;
170
+ } else {
171
+ const raw = value.trim();
172
+ if (!raw) return '-';
173
+
174
+ // dd.MM.yy or dd.MM.yyyy
175
+ const dot = raw.match(/^(\d{2})\.(\d{2})\.(\d{2}|\d{4})$/);
176
+ if (dot) {
177
+ const [, dd, mm, yy] = dot;
178
+ const year = yy.length === 2 ? 2000 + Number(yy) : Number(yy);
179
+ date = new Date(year, Number(mm) - 1, Number(dd));
180
+ if (!isValid(date)) return '-';
181
+ } else {
182
+ // normalize "YYYY-MM-DD HH:mm[:ss]" → ISO
183
+ const normalized = raw.replace(' ', 'T');
184
+ date = new Date(normalized);
185
+ if (!isValid(date)) return '-';
186
+
187
+ hasTime = /\d{1,2}:\d{2}/.test(raw);
188
+ hasSeconds = /\d{1,2}:\d{2}:\d{2}/.test(raw);
189
+ }
190
+ }
220
191
 
221
- const day = String(date.getDate()).padStart(2, '0');
222
- const monthShort = date.toLocaleString('en-US', { month: 'short' });
223
- const year = date.getFullYear();
224
- const base = `${day} ${monthShort} ${year}`;
192
+ const base = `${format(date, 'dd')} ${date.toLocaleString('en-US', {
193
+ month: 'short',
194
+ })} ${format(date, 'yyyy')}`;
225
195
 
226
- if (!hasTime) {
227
- return base;
228
- }
196
+ if (!hasTime) return base;
229
197
 
230
- const hours = String(date.getHours()).padStart(2, '0');
231
- const minutes = String(date.getMinutes()).padStart(2, '0');
232
- const time =
233
- includeSeconds
234
- ? `${hours}:${minutes}:${String(date.getSeconds()).padStart(2, '0')}`
235
- : `${hours}:${minutes}`;
198
+ const showSeconds = options?.includeSeconds ?? false;
236
199
 
200
+ const time = format(date, showSeconds ? 'HH:mm:ss' : 'HH:mm');
237
201
  return `${base}, ${time}`;
238
202
  }