diff --git a/src/Plugin/Block/DigitalClockBlock.php b/src/Plugin/Block/DigitalClockBlock.php
index a2111d7..43e01c3 100644
--- a/src/Plugin/Block/DigitalClockBlock.php
+++ b/src/Plugin/Block/DigitalClockBlock.php
@@ -3,7 +3,9 @@
 namespace Drupal\adc_block\Plugin\Block;
 
 use Drupal\Core\Block\BlockBase;
+use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides a Block to display last visited pages you visited on the website.
@@ -15,6 +17,53 @@ use Drupal\Core\Form\FormStateInterface;
  */
 class DigitalClockBlock extends BlockBase {
 
+  /**
+   * The date formatter service.
+   *
+   * @var \Drupal\Core\Datetime\DateFormatterInterface
+   */
+  protected $dateFormatter;
+
+  /**
+   * The entity type manager.
+   *
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   */
+  protected $entityTypeManager;
+
+  /**
+   * Constructs a new DigitalClockBlock object.
+   *
+   * @param array $configuration
+   *   A configuration array containing information about the plugin instance.
+   * @param string $plugin_id
+   *   The plugin_id for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
+   *   The date formatter service.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatterInterface $date_formatter, EntityTypeManagerInterface $entity_type_manager) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->dateFormatter = $date_formatter;
+    $this->entityTypeManager = $entity_type_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $container->get('date.formatter'),
+      $container->get('entity_type.manager')
+    );
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -47,10 +96,10 @@ class DigitalClockBlock extends BlockBase {
       $current_timestamp = time();
 
       if ($custom_fromat) {
-        $current_date = \Drupal::service('date.formatter')->format($current_timestamp, 'custom', $date_format);
+        $current_date = $this->dateFormatter->format($current_timestamp, 'custom', $date_format);
       }
       else {
-        $current_date = \Drupal::service('date.formatter')->format($current_timestamp, $date_format);
+        $current_date = $this->dateFormatter->format($current_timestamp, $date_format);
       }
     }
 
@@ -218,7 +267,7 @@ class DigitalClockBlock extends BlockBase {
 
     $date_formats = [];
 
-    $formats = \Drupal::entityTypeManager()
+    $formats = $this->entityTypeManager
       ->getStorage('date_format')
       ->loadMultiple();
 
@@ -227,7 +276,7 @@ class DigitalClockBlock extends BlockBase {
         '@name format: @date',
         [
           '@name' => $value->label(),
-          '@date' => \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime(), $machine_name),
+          '@date' => $this->service('date.formatter')->format($this->time()->getRequestTime(), $machine_name),
         ]
       );
     }
