| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 22 |
| Technical Name |
web_datetime_patch |
| License | See License tab |
| Website | https://trishanfernando.com/ |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 22 |
| Technical Name |
web_datetime_patch |
| License | See License tab |
| Website | https://trishanfernando.com/ |
Keep the year visible in localized dates and datetimes
Web Datetime Year Patch is a lightweight Odoo 19.0 module that ensures the year is always included whenever the web client formats localized dates or datetimes. No configuration required.
What it does
Always Show Year
Ensures localized date and datetime strings include the year in all formats.
Backend Only
Applies in the backend web assets bundle. No impact on user data or API.
Safe & Clean
Leaves original format objects untouched by using a shallow copy.
How it works
The module overrides Luxon's DateTime.toLocaleString() in the browser. When Odoo passes a format object without a year, the patch adds year: 'numeric' before delegating back to the original formatter.
Note: This is a display-level fix only. It does not modify stored dates, business logic, or server-side values.
Key Features
Installation
- Add the module to your Odoo addons path
- Update the app list
- Install Web datetime year patch
- Patch applied automatically in backend
Requirements
- Odoo 19.0
- Web module (built-in)
- No additional dependencies
- No database migrations
Technical Details
The patch is implemented clean and minimal. It intercepts Luxon's formatter only when needed, ensuring no performance impact or side effects. Perfect for projects where keeping the year visible across all date displays improves clarity in record lists, forms, and reporting.
MIT License Copyright (c) 2025 Trishan Fernando Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module