Thank you so much for this module, it's one I have been waiting for, for quite a while.

I added the module as instructed and added a new time range to one of my content types. When saving the node the site goes to The website encountered an unexpected error. Please try again later.

I get the following in the watchdog:
Error: Class 'Webmozart\Assert\Assert' not found in Drupal\time_field\Time->__construct() (line 46 of /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/modules/time_field/src/Time.php) #0 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/modules/time_field/src/Time.php(142): Drupal\time_field\Time->__construct('05', '00', 0) #1 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/modules/time_field/src/Element/TimeElement.php(50): Drupal\time_field\Time::createFromHtml5Format('05:00') #2 [internal function]: Drupal\time_field\Element\TimeElement::valueCallback(Array, '05:00', Object(Drupal\Core\Form\FormState)) #3 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(1254): call_user_func_array(Array, Array) #4 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(990): Drupal\Core\Form\FormBuilder->handleInputElement('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #5 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(1060): Drupal\Core\Form\FormBuilder->doBuildForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #6 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(1060): Drupal\Core\Form\FormBuilder->doBuildForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #7 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(1060): Drupal\Core\Form\FormBuilder->doBuildForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #8 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(1060): Drupal\Core\Form\FormBuilder->doBuildForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #9 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(561): Drupal\Core\Form\FormBuilder->doBuildForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #10 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('node_ttslo_form', Array, Object(Drupal\Core\Form\FormState)) #11 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm('node_ttslo_form', Object(Drupal\Core\Form\FormState)) #12 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/modules/node/src/Controller/NodeController.php(113): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\node\Entity\Node)) #13 [internal function]: Drupal\node\Controller\NodeController->add(Object(Drupal\node\Entity\NodeType)) #14 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #15 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #17 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #18 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #20 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/modules/jsonapi/src/StackMiddleware/FormatSetter.php(51): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/core/lib/Drupal/Core/DrupalKernel.php(666): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /srv/bindings/5823e151c7054261ac362f6b9dc553db/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #30 {main}.

Can I provide any additional help to troubleshoot?

Thanks in advance,
Jay

Comments

jeppy64 created an issue. See original summary.

astonvictor’s picture

Hi there.

You should install Webmozart
composer require webmozart/assert

c13l0’s picture

Can the library be added the traditional drupal way aka using the libraries folder? I'm a bit confused because this module says no dependencies and does not state that it has to be installed via Composer. We have 19 sites on Pantheon which were not built with Composer and will break all the things if we try to use composer....

README.md

REQUIREMENTS
------------
This module does not depend on any module.

CONFIGURATION
-------------
The module has no menu or modifiable settings. There is no configuration. When
enabled, the module will add "time" and "time-range" fields. To remove mentioned fields, disable the module and clear caches.

INSTALLATION
------------

* Install as you would normally install a contributed Drupal module. Visit:
https://drupal.org/documentation/install/modules-themes/modules-8
for further information.

lostkoder’s picture

Assert library moved into module in 8.x-1.6 version.
Now you can use it without composer.
Thanks for reporting.

lostkoder’s picture

Status: Active » Fixed
lostkoder’s picture

Status: Fixed » Closed (fixed)
c13l0’s picture

@lostkoder

Just wanted to say a HUGE THANK YOU!!! Seriously, you are the type of developer that embodies the Drupal community.