Problem/Motivation

1. Getting the following error: TypeError: Unsupported operand types: string + int in Drupal\office_hours\OfficeHoursDateHelper::format() (line 158 of /var/www/html/docroot/modules/contrib/office_hours/src/OfficeHoursDateHelper.php).

Steps to reproduce

Please see the screenshot and fill the value same way.
issue

Then click on save button.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

shashank5563 created an issue. See original summary.

shashank5563’s picture

Priority: Normal » Major
abhishek_gupta1’s picture

Assigned: Unassigned » abhishek_gupta1

abhishek_gupta1’s picture

Assigned: abhishek_gupta1 » Unassigned
Status: Active » Needs review

@shashank5563, I have fixed the issue and created MR. please review it once.

shashank5563’s picture

StatusFileSize
new847 bytes
johnv’s picture

Title: TypeError: Unsupported operand types: string + int in Drupal\office_hours\OfficeHoursDateHelper::format() » TypeError: Unsupported operand types: string + int in OfficeHoursDateHelper::format() with empty pm hour field
Version: 8.x-1.x-dev » 8.x-1.17
Component: Code » Code - widget
Priority: Major » Minor
Status: Needs review » Fixed
StatusFileSize
new2.62 KB

Thanks, I will commit the attached patch, which is equivalent to the above soution.
I think this is a minor error, not a major one, since no site is broken, and the given test case (empty pm hour) will give an error message 'The time is incomplete. A value must be selected for hour.' anyway.

johnv’s picture

  • johnv committed d1ead327 on 8.x-1.x
    Issue #3455363 by abhishek_gupta1, shashank5563: TypeError: Unsupported...
plopesc’s picture

Status: Fixed » Needs work

Wrong comment

plopesc’s picture

Status: Needs work » Fixed

  • johnv committed 21d5fb30 on 8.x-1.x
    Issue #3455363 by abhishek_gupta1, shashank5563: TypeError: Unsupported...
johnv’s picture

Above patch changes the check for correct filling of the time, sepecifically the empty hours field.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.