[BUG]: PDF export shows January 1970 for missing invoice dates

Open Beginner friendly
#265 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@anshulchikhale30-p is already working on this.

Since Nov 4, 2026.

  • #345 by @anshulchikhale30-p — open
  • #373 by @anshulchikhale30-p — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript

Research direction

Start in frontend/src/utils/generateInvoicePDF.js, where the issue says the issue and due dates are passed to new Date() before formatting; check how the PDF fields are built and read the existing date formatting logic. Compare missing or invalid dates with valid dates for both fields. Done means unavailable dates show a placeholder such as N/A, while valid dates retain their existing formatting.

Written by the indexing model from the issue text.

Description

bug

Bug Description

When exporting an invoice to PDF, missing issue dates or due dates can incorrectly appear as January 1, 1970.

In frontend/src/utils/chainInvoice.js, invoices without a trusted local payload can have issueDate and dueDate set to null.

However, frontend/src/utils/generateInvoicePDF.js passes these values directly to new Date() before formatting them:

new Date(invoice.issueDate)
new Date(invoice.dueDate)

In JavaScript, new Date(null) evaluates to January 1, 1970. As a result, when an invoice has no available date information, the generated PDF may display January 1, 1970 instead of indicating that the date is unavailable.

Steps to Reproduce

  1. Open an invoice whose original issue or due date information is unavailable locally.
  2. Export the invoice as a PDF.
  3. Open the generated PDF.
  4. Inspect the Issued and Due date fields.
  5. Observe that a missing date may be displayed as January 1, 1970.

Expected Behavior

If the issue date or due date is missing or invalid, the generated PDF should display an appropriate placeholder such as N/A instead of an incorrect date.

If a valid date is available, it should be formatted and displayed normally.

Actual Behavior

When issueDate or dueDate is null, the PDF generation logic converts the value into a JavaScript Date object, which results in January 1, 1970 being displayed.

Impact

This can cause exported invoices to contain incorrect date information. Since PDF invoices may be shared with customers or used for accounting and record keeping, displaying January 1, 1970 can be misleading and may make the invoice appear to have a date that was never provided.

Suggested Fix

Validate issueDate and dueDate before converting them into Date objects.

  • If a date is missing or invalid, display a placeholder such as N/A.
  • If a valid date exists, format it using the existing date-formatting logic.
  • Apply the same validation to both issue and due dates.

Affected Files

  • frontend/src/utils/chainInvoice.js
  • frontend/src/utils/generateInvoicePDF.js

Environment

  • Application: Chainvoice
  • Feature: Invoice PDF export

Checklist

  • I have joined the Discord server and will post updates there.
  • I have searched existing issues to avoid duplicates.
Dominant language
JavaScript
Stars
13
Forks
62
Avg merge
2d 14h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/Chainvoice

All issues in StabilityNexus/Chainvoice

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.