- Issue created by @codebymikey
- Merge request !48Issue #3530530 by codebymikey: StrToTime: Support custom date formats → (Merged) created by codebymikey
- 🇳🇱Netherlands megachriz
This is a great addition! I do wonder if we should fallback to
strtotime()
when parsing the date fails. Maybe provide that as an option? "Fallback tostrtotime()
if the date could not be parsed.". What do you think?If you have applied the Tamper "String to Unix Timestamp" to the source "date" and set the date format to "d/m/Y" and then import the following CSV:
title,date Foo,2020-09-01 Bar,01/11/2011 Qux,01-10-2011
This is the result after import (using the latest dev releases of Feeds and Feeds Tamper):
- Issue was unassigned.
- Status changed to RTBC
6 days ago 8:18am 18 August 2025 The fallback option seems useful, the more flexibility the better.
I'd still personally recommend that users avoid using
strtotime()
blindly since as per the original issue, it can accidentally convert it into an invalid date, so your feed should ideally have a standardized format to convert from (however having the fallback option still wouldn't hurt for cases where the dates are entered manually).All that being said, the code and tests looks good! RTBC.
-
megachriz →
committed d6c4df5d on 8.x-1.x authored by
codebymikey →
Issue #3530530 by codebymikey, megachriz: StrToTime: Allow using a...
-
megachriz →
committed d6c4df5d on 8.x-1.x authored by
codebymikey →