Skip to main content
iVentureTeam

relative_date

New in Odoo 20 and the direct replacement for remaining_days. It fixes a real annoyance in the old widget: a date three weeks away no longer reads as "next month".

September 18, 2026Updated September 18, 20264 min read
Technical namerelative_date
Field typesdate, datetime
Viewsform, list, kanban, card
Moduleweb, present in every Odoo 20 database
Used in core38 uses across Odoo 20 Community and Enterprise views, excluding tests. Does not exist in Odoo 19.
VersionsOdoo 20.0
No-code setupNo Studio entry of its own, though it keeps the Remaining Days display name the old widget used.
Alternativesremaining_days, date, datetime, daterange

What the relative_date widget does

relative_date renders a date or datetime as a distance from now: three days ago, in four weeks, in two months. Odoo 19 did this with remaining_days, which leaned on Luxon's default relative formatting.

The new widget adds a threshold table that decides which unit to use:

const RELATIVE_RANGES = [
    { thresholdUnit: "weeks",  displayUnit: "days",   maxUnits: 1 },
    { thresholdUnit: "months", displayUnit: "weeks",  maxUnits: 1, verifyCalendarBoundary: true },
    { thresholdUnit: "years",  displayUnit: "months", maxUnits: 1 },
    { thresholdUnit: "years",  displayUnit: "years",  maxUnits: Infinity },
];

The first entry whose gap fits wins, and the date renders one level more precisely than the threshold that matched. A date 24 days away is within one month, so it shows in weeks: In 4 weeks.

What this means for your team

This is a small change with a real effect on any screen where people triage by date. Odoo 19 could describe anything between one and sixty days as "next month", which is useless for deciding what to chase today.

Odoo 20 gives you weeks where weeks are meaningful. A follow-up in four weeks and a follow-up next month now look different, because they are different.

If you are upgrading, the important part is not the improvement. It is that remaining_days is gone with no alias, so every view that used it needs editing.

Supported options in Odoo 20

The widget declares no options at all. It reads one, which makes that option real but invisible to Studio and to every options helper.

OptionTypeWhat it does
classesdictionary of class to expression<strong>Undocumented: not declared in supportedOptions.</strong> Maps a CSS decoration to a Python expression evaluated with <code>days</code>, the signed distance in days, and the record in scope. The component's default bolds anything already due. Carried over unchanged from the Odoo 19 remaining_days widget.(default: {'bf': 'days <= 0'})(since Odoo 20.0)

classes is read in extractProps and evaluated against a context containing days and the record, so you can style the value conditionally on how far away the date is. The component ships a default of { bf: "days <= 0" }, which bolds anything already due.

Working examples

Basic use:

<field name="date_deadline" widget="relative_date"/>

Conditional styling through the undocumented option:

<field name="date_deadline" widget="relative_date"
       options="{'classes': {'text-danger': 'days < 0', 'bf': 'days <= 0'}}"/>

The Odoo 19 line that no longer works, and its replacement:

<!-- Odoo 19, removed in Odoo 20 with no alias -->
<field name="date_deadline" widget="remaining_days"/>

<!-- Odoo 20 -->
<field name="date_deadline" widget="relative_date"/>

The month-boundary guard, and why it exists

One entry in the threshold table carries a flag the others do not:

{ thresholdUnit: "months", displayUnit: "weeks", maxUnits: 1, verifyCalendarBoundary: true },

The source explains the case it defends against. Measuring from 30 January, the gap to 1 March floors to one month, which would match this entry and render the date in weeks. But 1 March is in the month after next, so weeks is the wrong unit and the result misleads.

Months are not a fixed length, so a naive floor division produces this class of error near boundaries. The guard checks the actual calendar rather than trusting the arithmetic.

This matters more than it sounds on a pipeline or deadline list, because the errors cluster at month ends, which is exactly when people are reviewing what is due.

Worth being precise about the Studio angle too. The descriptor keeps displayName: _t("Remaining Days"), the same label the Odoo 19 widget carried. So someone configuring a view through Studio sees the same name before and after the upgrade and has no signal that the underlying widget was replaced. Only the XML changed.

Version compatibility

VersionStatusNotes
Odoo 19.0Not availableDoes not exist. The equivalent widget is remaining_days.
Odoo 20.0VerifiedIntroduced in Odoo 20. Verified against the shipped 20.0 source.

This widget does not exist before Odoo 20.

What is changing in Odoo 20

Introduced in Odoo 20 as the replacement for remaining_days.

We verified that remaining_days is gone completely: the string does not appear anywhere in the Odoo 20 addons tree, in JavaScript or XML. There is no alias, so a view carrying it logs a missing-widget warning and falls back to rendering the field by its type, which for a date means an ordinary date display rather than a relative one.

The classes option carries over from the old widget unchanged, so styling written for remaining_days keeps working once the widget name is updated.

Common problems and fixes

SymptomCause and fix
A view using remaining_days stopped rendering relative dates after upgradingremaining_days was removed in Odoo 20 with no alias. Change the widget to relative_date. The classes option carries over unchanged.
The classes option does not appear in StudioIt is undeclared. The widget has no supportedOptions at all. Set it in the view XML. It works despite being undocumented.
Dates near a month boundary read oddlyThey should not, and that is the point of verifyCalendarBoundary. If they do, the widget is not the one rendering them. Confirm the field is actually using relative_date rather than falling back to its default widget.
Studio still shows the name Remaining DaysThe new widget deliberately keeps that displayName. Expected. Check the XML to confirm which widget is in use.

Relative_date widget vs the alternatives

WidgetBest forKey difference
relative_dateTriage screens where how soon matters more than exactly whenExplicit unit thresholds plus a month-boundary guard, new in Odoo 20
remaining_daysThe same job on Odoo 19Removed in Odoo 20 with no alias; vaguer unit selection
dateThe exact dateAbsolute rather than relative
datetimeAn exact date and timeAbsolute, with time of day
daterangeA start and end pairTwo dates rather than a distance

Use date or datetime when the exact date is what people need to read, for example anything they will quote to a customer. Use relative_date on triage screens, where the question is how soon rather than exactly when. A list that mixes both, an exact date column and a relative one, usually satisfies everybody.

Frequently asked questions

What replaced remaining_days in Odoo 20?+
relative_date. The old widget was removed with no backward-compatible alias, so every view using it needs the widget name changed. The classes option carries over unchanged.
Does relative_date have any options?+
It declares none, but reads classes in extractProps. That option maps a CSS decoration to an expression evaluated with days in scope, and it will not appear in Studio or any options helper.
Why does Odoo 20 show 'In 4 weeks' where Odoo 19 said 'next month'?+
Because the new widget uses an explicit threshold table. A date within one month is displayed in weeks rather than months, which avoids Luxon's default behavior of calling anything from one to sixty days away next month.
Why does Studio still call it Remaining Days?+
The Odoo 20 descriptor keeps displayName: "Remaining Days", the same label the old widget used, so nothing in Studio signals that the underlying widget changed.

Date widgets that vanish in an Odoo 20 upgrade?

remaining_days is one of sixty-two registrations Odoo 20 removed, and it leaves no alias behind to warn you. We diff your views against the 20.0 branch and hand you the exact list of widget names to change.

Get an upgrade audit

How this page was produced

Verified by reading addons/web/static/src/views/fields/relative_date/relative_date_field.js on the 20.0 branch of a local clone of the official Odoo repository, with the threshold table and the boundary guard quoted above and the classes option read from extractProps. The absence of remaining_days was confirmed by searching the entire Odoo 20 addons tree for that string in both JavaScript and XML. The usage count comes from scanning every non-test XML file in Community, Enterprise and odoo/addons on the 20.0 branch. Corrections welcome via our contact page.