Skip to content

Commit

Permalink
Fix wrong timezone esigned at dates in pdfs (#4929)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotondo authored Oct 29, 2024
1 parent 3c8981d commit 77a2850
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/lib/pdf_filler/id40_pdf.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module PdfFiller
class Id40Pdf
include PdfHelper
include SubmissionBuilder::FormattingMethods

def source_pdf_name
"idform40-TY-2023"
Expand Down Expand Up @@ -48,7 +49,7 @@ def hash_for_pdf
)
end
if @submission.data_source.primary_esigned_yes?
answers["DateSign 2"] = @submission.data_source.primary_esigned_at.strftime("%m-%d-%Y")
answers["DateSign 2"] = date_type_for_timezone(@submission.data_source.primary_esigned_at)&.strftime("%m-%d-%Y")
answers["TaxpayerPhoneNo"] = @submission.data_source.direct_file_data.phone_number
end
answers
Expand Down
5 changes: 3 additions & 2 deletions app/lib/pdf_filler/nc_d400_pdf.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module PdfFiller
class NcD400Pdf
include PdfHelper
include SubmissionBuilder::FormattingMethods

def source_pdf_name
"ncD400-TY2024"
Expand Down Expand Up @@ -73,8 +74,8 @@ def hash_for_pdf
y_d400wf_li27_pg2_good: @xml_document.at('TotalAmountDue')&.text,
y_d400wf_li28_pg2_good: @xml_document.at('Overpayment')&.text,
y_d400wf_li34_pg2_good: @xml_document.at('RefundAmt')&.text,
y_d400wf_sigdate: @submission.data_source.primary_esigned_yes? ? @submission.data_source.primary_esigned_at.to_date : "",
y_d400wf_sigdate2: @submission.data_source.spouse_esigned_yes? ? @submission.data_source.spouse_esigned_at.to_date : ""
y_d400wf_sigdate: @submission.data_source.primary_esigned_yes? ? date_type_for_timezone(@submission.data_source.primary_esigned_at)&.to_date : "",
y_d400wf_sigdate2: @submission.data_source.spouse_esigned_yes? ? date_type_for_timezone(@submission.data_source.spouse_esigned_at)&.to_date : ""
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
end

it "handles timezone correctly for signature date when the filer esigns after midnight UTC but not after midnight in the State's timezone" do
expect(doc.at('Filer Primary DateSigned').content).to eq Date.today.strftime("%Y-%m-%d")
expect(doc.at('Filer Primary DateSigned').content).to eq tomorrow_midnight.in_time_zone("America/New_York").strftime("%Y-%m-%d")
expect(doc.at('Filer Secondary DateSigned')).not_to be_present
end
end
Expand All @@ -190,8 +190,8 @@
end

it "it correctly signs with the date of the correct timezone when the filer esigns after midnight UTC but not after midnight in the State's timezone" do
expect(doc.at('Filer Primary DateSigned').content).to eq Date.today.strftime("%Y-%m-%d")
expect(doc.at('Filer Secondary DateSigned').content).to eq Date.today.strftime("%Y-%m-%d")
expect(doc.at('Filer Primary DateSigned').content).to eq tomorrow_midnight.in_time_zone("America/New_York").strftime("%Y-%m-%d")
expect(doc.at('Filer Secondary DateSigned').content).to eq tomorrow_midnight.in_time_zone("America/New_York").strftime("%Y-%m-%d")
end
end
end
Expand Down

0 comments on commit 77a2850

Please sign in to comment.