Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Invoice generator: the next number adds `INV` to plain numbers and changes the padding

Abierto Apto para principiantes
#220 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
94/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
next.js, react, typescript
Área
frontend

Línea de trabajo

Empieza por nextInvoiceNumber en lib/invoice-types.ts y luego revisa los casos existentes en lib/__tests__/invoice-types.test.ts. Añade cobertura para cada ejemplo, el caso de crecimiento de ancho y el valor predeterminado para una lista vacía; después ejecuta npm run lint, npm run test y npm run build. Los puntos de llamada del cliente del generador de facturas no deberían necesitar cambios.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug good first issue hacktoberfest

nextInvoiceNumber (lib/invoice-types.ts, line 159) is meant to keep the prefix and zero padding of the highest saved invoice (its comment, lines 154 to 157), but:

Highest saved number Next number now Expected
1001 INV1002 1002
INV-07 INV-0008 INV-08
A1 A0002 A2
2026-001 2026-0002 2026-002
999 INV1000 1000
INV0007 INV0008 INV0008 (already right)

An empty prefix is falsy, so match[1] || fallbackPrefix (line 169) swaps it for INV, and Math.max(pad, match[2].length) (line 170) pads every number to at least 4 digits. On the invoice generator you see it when you save an invoice numbered 1001 and click New.

What to do

  • Keep the prefix as it is, even when it's empty, and pad to the width of the highest number's digits (match[2].length).
  • Use INV and 4 digits only for an empty list, so it still starts at INV0001.
  • A number that outgrows its width just gets longer: INV-99 gives INV-100.

Where to look

  • lib/invoice-types.ts: nextInvoiceNumber (lines 154 to 174)
  • lib/__tests__/invoice-types.test.ts: the nextInvoiceNumber tests (line 75)
  • The client calls it in several places (InvoiceGeneratorClient.tsx, lines 58, 65, 70, 76, 105 and 130), and none of them need to change.

Acceptance criteria

  • Every row in the table gives the expected number, INV-99 gives INV-100, and an empty list still gives INV0001
  • Tests for these cases (the ones that change fail on the current code)
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #220 in the description.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
9
Merge medio
10 h 24 min
PR fusionados (30 d)
93

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codercops/toolbelt

Todos los issues de codercops/toolbelt

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.