Problem/Motivation

When import period is set to off and you view the import it shows as

Next import: Wed, 12/31/1969 - 16:59

Steps to reproduce

1. In import type, set import period to "off"

Showing when set to off

2. View your import (you likely will need to run it, so it updates)

Showing the issue

Proposed resolution

Add a conditional in the feeds_feeds.html.twig file so it checks.

Remaining tasks

  • Add test coverage:
    • When periodic import is configured for a feed type, the date for the next import should be displayed.
    • When periodic import is NOT configured for a feed type, it should say "Not scheduled".
    • When periodic import is NOT configured for a feed type, but an import in background is started, it should say "On next cron run" (or something similar, refer to the D7 version of Feeds for that).
  • When import in background gets started, "Next import" should say "On next cron run" or something similar (check what the D7 version of Feeds does in this case).

Issue fork feeds-3523270

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

no sssweat created an issue. See original summary.

no sssweat’s picture

Title: Next import showing when import period set to "off" » Next import showing when import period set to 'off'
no sssweat’s picture

StatusFileSize
new930 bytes

Here is a patch, I tested it so it would still work even if someone changes the Next import date format in Manage Display.

no sssweat’s picture

StatusFileSize
new528 bytes

Re-rolled the patch, my IDE accidentally modified some of the spacing up top.

no sssweat’s picture

Status: Active » Needs review
no sssweat’s picture

StatusFileSize
new533 bytes

Updated conditional so it's compatible with any timezone.

megachriz made their first commit to this issue’s fork.

megachriz’s picture

It depends on the current user time zone for how the date is displayed. For example, I have for one feed displaying the following:

do, 01/01/1970 - 00:59

I think it is better to fix this in FeedViewBuilder and replace the date with the text 'Not scheduled'. This is also consistent with how a similar issue was fixed in the D7 version of Feeds.

It will then look like this:

megachriz’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs tests

I think it would be good to add tests for this. The tests should cover the following:

  • When periodic import is configured for a feed type, the date for the next import should be displayed.
  • When periodic import is NOT configured for a feed type, it should say "Not scheduled".
  • When periodic import is NOT configured for a feed type, but an import in background is started, it should say "On next cron run" (or something similar, refer to the D7 version of Feeds for that).

Since I think that case 3 is currently not working, setting this issue to "Needs work".

megachriz’s picture

Status: Needs work » Needs review

I think the fix and the tests are good enough.

benstallings’s picture

Status: Needs review » Needs work

Claude Code says,

Issues

1. Missing use statement in FeedViewBuilder

The PHPCS fix commit (4a3969cf) removed the use Drupal\feeds\ScheduledFeedInterface import from FeedViewBuilder.php. But the class references ScheduledFeedInterface at line 60:
if ($feed instanceof ScheduledFeedInterface) {

This works because Feed is in the same Drupal\feeds namespace, so PHP resolves the unqualified class name. But it's inconsistent — other classes like Feed.php correctly import ScheduledFeedInterface. The use statement should be restored; the PHPCS tool likely flagged it incorrectly because it didn't detect the instanceof usage.

2. Unused $key in the foreach loop

FeedViewBuilder.php:56: foreach ($builds as $key => &$build) {

$key is never used. PHPCS or PHPStan may flag this. Consider foreach ($builds as &$build).

3. Test docblock typo
ImportPeriodTest::testDisplayNextImportWithPeriodicImportOff():

▎ "Tests not scheduled feed should not display a data."

Should be "Tests that an unscheduled feed does not display a date."

4. Commit ordering creates a broken intermediate state

Same pattern as the other branches: the test commit (f425d5cc) asserts the fixed behavior, but the fix commit (2842a157) comes after it. At commit f425d5cc, the tests would fail. Should be squashed or reordered.

5. Consider: isScheduled() returns true for queued inactive feeds

  if ($this->getQueuedTime() > 0) {
      return TRUE;
  }
  if (!$this->isActive()) {
      return FALSE;
  }

If a feed is deactivated while it's queued, isScheduled() returns TRUE because the queued check comes first. This matches the test testDisplayNextImportWhenSchedulingManuallyForInactiveFeed — a manually scheduled inactive feed should say "On next cron run". This is correct behavior, but worth a brief comment explaining the intentional priority, since it's a subtle edge case.

What looks good

- Test coverage is thorough: 5 functional tests covering the main scenarios — scheduled, periodic-off, manually scheduled, inactive+queued, inactive+future-time. The 1969/1970 assertions are a nice touch to guard against epoch-date display bugs.
- The constant replacement in feeds_cron() (-1 → SCHEDULE_NEVER) is a good cleanup.
- The interface is appropriately scoped — single method, clear contract, doesn't over-abstract.
- The isScheduled() logic correctly handles the interaction between queued state, active state, and the SCHEDULE_NEVER sentinel.

Summary

This is a clean, well-scoped fix. The core logic is correct, the test coverage is good, and the architecture (new interface + view builder integration) is sound. The issues are minor — a likely-wrong use removal in the PHPCS commit, a typo, and commit ordering. Should be straightforward to merge after cleanup.

benstallings’s picture

Assigned: Unassigned » benstallings
benstallings’s picture

Assigned: benstallings » Unassigned
Status: Needs work » Needs review
megachriz’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Thanks for testing and the feedback. I've scheduled the merge.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • megachriz committed 32773669 on 8.x-3.x
    fix: #3523270 When the feed is not scheduled, set text for field 'next'...

Status: Fixed » Closed (fixed)

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