[PP-1] Deprecate TimeInterface::getCurrentTime() and replace with ClockInterface::now()->getTimestamp()

Created on 19 March 2025, 19 days ago

Problem/Motivation

Follow up to ✨ Implement PSR-20 in datetime.time service Active where we added a new \Psr\ClockInterface service we can inject.

We should switch from using \Drupal\Component\Datetime\TimeInterface::getCurrentTime() and instead use the PSR-20 \Psr\ClockInterface::now()->getTimestamp() for PHP interoperability.

We can also add a \Drupal::clock() method to help with non-dependency injected code.

Steps to reproduce

Proposed resolution

  • Deprecate \Drupal\Component\Datetime\TimeInterface::getCurrentTime()
  • Add a code>\Drupal::clock() method
  • Replace instances of \Drupal\Component\Datetime\TimeInterface::getCurrentTime() with \Psr\ClockInterface::now()->getTimestamp()

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Postponed

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡¦πŸ‡ΊAustralia kim.pepper πŸ„β€β™‚οΈπŸ‡¦πŸ‡ΊSydney, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024