fix(web): las fechas con hora que trae SAP se ven en los campos de fecha de los maestros
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
91d5135dc7
commit
5db5de65ad
2 files changed
+11
-4
No files matched your search
@@ -17,9 +17,9 @@ const lote = (over: Record<string, unknown> = {}) => ({
|
|||||||
Status: 'bdsStatus_Released',
|
Status: 'bdsStatus_Released',
|
||||||
BatchAttribute1: 'PROV-1',
|
BatchAttribute1: 'PROV-1',
|
||||||
BatchAttribute2: null,
|
BatchAttribute2: null,
|
||||||
AdmissionDate: '2026-01-05',
|
AdmissionDate: '2026-01-05T00:00:00Z',
|
||||||
ManufacturingDate: '2025-12-01',
|
ManufacturingDate: '2025-12-01T00:00:00Z',
|
||||||
ExpirationDate: '2028-12-01',
|
ExpirationDate: '2028-12-01T00:00:00Z',
|
||||||
Details: null,
|
Details: null,
|
||||||
...over,
|
...over,
|
||||||
});
|
});
|
||||||
@@ -73,6 +73,12 @@ describe('Lotes (BatchNumberDetails)', () => {
|
|||||||
expect([...el().querySelectorAll('[role=tab]')].map((t) => t.textContent?.trim())).toEqual(['General', 'Detalles']);
|
expect([...el().querySelectorAll('[role=tab]')].map((t) => t.textContent?.trim())).toEqual(['General', 'Detalles']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('las fechas que trae SAP con hora se ven en el selector de fecha', async () => {
|
||||||
|
await open('74701', lote());
|
||||||
|
const dates = [...el().querySelectorAll<HTMLInputElement>('input[type=date]')].map((i) => i.value);
|
||||||
|
expect(dates).toEqual(['2026-01-05', '2025-12-01', '2028-12-01']);
|
||||||
|
});
|
||||||
|
|
||||||
it('un lote bloqueado se ve como tal', async () => {
|
it('un lote bloqueado se ve como tal', async () => {
|
||||||
await open('74701', lote({ Status: 'bdsStatus_Locked' }));
|
await open('74701', lote({ Status: 'bdsStatus_Locked' }));
|
||||||
expect(el().querySelector('.badge.tone-warn')?.textContent?.trim()).toBe('Bloqueado');
|
expect(el().querySelector('.badge.tone-warn')?.textContent?.trim()).toBe('Bloqueado');
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ export class MasterField {
|
|||||||
const f = this.field();
|
const f = this.field();
|
||||||
return f.type === 'lookup' && f.lookup.valueType === 'number' && /^\d+$/.test(code.trim()) ? Number(code) : code;
|
return f.type === 'lookup' && f.lookup.valueType === 'number' && /^\d+$/.test(code.trim()) ? Number(code) : code;
|
||||||
}
|
}
|
||||||
protected readonly str = computed(() => text(this.value()));
|
/** El texto del campo; una fecha de SAP llega como `2031-10-31T00:00:00Z` y el selector de fecha pide `yyyy-MM-dd`. */
|
||||||
|
protected readonly str = computed(() => (this.field().type === 'date' ? text(this.value()).slice(0, 10) : text(this.value())));
|
||||||
protected readonly num = computed(() => (this.value() === '' || this.value() === null || this.value() === undefined ? null : Number(this.value())));
|
protected readonly num = computed(() => (this.value() === '' || this.value() === null || this.value() === undefined ? null : Number(this.value())));
|
||||||
protected readonly required = computed(() => {
|
protected readonly required = computed(() => {
|
||||||
const f = this.field();
|
const f = this.field();
|
||||||
|
|||||||
Reference in new issue
Block a user