diff --git a/app/lib/pdf_filler/id40_pdf.rb b/app/lib/pdf_filler/id40_pdf.rb index cf591b72a2..f69f1e7165 100644 --- a/app/lib/pdf_filler/id40_pdf.rb +++ b/app/lib/pdf_filler/id40_pdf.rb @@ -1,6 +1,7 @@ module PdfFiller class Id40Pdf include PdfHelper + include SubmissionBuilder::FormattingMethods def source_pdf_name "idform40-TY-2023" @@ -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 diff --git a/app/lib/pdf_filler/nc_d400_pdf.rb b/app/lib/pdf_filler/nc_d400_pdf.rb index 45f648dbea..3d313993ae 100644 --- a/app/lib/pdf_filler/nc_d400_pdf.rb +++ b/app/lib/pdf_filler/nc_d400_pdf.rb @@ -1,6 +1,7 @@ module PdfFiller class NcD400Pdf include PdfHelper + include SubmissionBuilder::FormattingMethods def source_pdf_name "ncD400-TY2024" @@ -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 diff --git a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb index 62bf6dd5df..00a7771a0f 100644 --- a/spec/lib/submission_builder/ty2022/states/return_header_spec.rb +++ b/spec/lib/submission_builder/ty2022/states/return_header_spec.rb @@ -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 @@ -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