Search
Other Articles Anywhere questions
Forum

adding 1 hour to a Calendar Custom Field with Articles Anywhere

Marc's Avatar Marc
Hi,
I am using Articles Anywhere together with a Custom Field called [date-et-heure] for a event.

Then for a "add to calendar button", I need to manipulate the date.
Showing only the day is easy : [date-et-heure format="Y-m-d"]
Showing only the time is easy : [date-et-heure format="H:i"]

But I need to compute a relative time, being the original time + X minutes (or + Y hours).
But I don't see how I should rewrite [date-et-heure format="H:i"]

Txs,

Marc

Hereafter, an excerpt of the code (with end time = start time as a temporary workaround)
<div class="atcb" style="display:none;">
  {
    "name":"[this:title]",
    "startDate":"[date-et-heure format="Y-m-d"]",
    "startTime":"[date-et-heure format="H:i"]",
    "endTime":"[date-et-heure format="H:i"]",
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases

On Joomla 4 you should now be able to do:
[date-et-heure format="Y-m-d H:i" modify="+3 hours"]

You can use any string in there that the PHP date modify function understands:
www.php.net/manual/en/datetime.modify.php
Please post a rating at the Joomla! Extensions Directory
Marc's Avatar Marc
Txs for this promising suggestion!

I had found the page about "relative dates" but nothing about this "modify" which is just excellent.

The only thing is that
[date-et-heure format="Y-m-d H:i" modify="+3 hours"]
gives the same as
[date-et-heure format="Y-m-d H:i"]
atm
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, I am on crappy internet at the moment (on Holiday), and it didn't upload. Try now:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Marc's Avatar Marc
Sorry, I did not mean to bother you during your holidays 🙂
Now works perfectly with the new Dev version. Txs!
Peter van Westen's Avatar Peter van Westen ADMIN
No problem and great 🙂
The new feature will be included in the next release.
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription