0

Is it possible to show the entry_date to the season it's been published? e.g. Written in Autumn at.........

This will also need to work in different time zones. Client will publish from Europe and Australia.

2
  • 1
    I believe is better for you to show the season, instead of save the season. How do you will order entries, for example?
    – Sobral
    Jun 24 '14 at 14:53
  • Hi Robson, I'll edit the original query to be more precise...
    – Nutmeg
    Jun 24 '14 at 19:27
1

You could use conditionals and the date format function to extract the month from the date and output a different season.

Of course you would then need to define seasons by the start/end of months. It's down to how precise you wish to be.

For instance;

{if "{entry_date format='%n'}" > 1 AND "{entry_date format='%n'}" < 5}
    It's Spring(ish) (matches feb, mar, apr)
{/if}

Thinking about this further you could be extremely precise if you forgo the automation and simply note the dates of the season changes for the next few years. How long do you expect this incarnation of the site to be live? It strikes me that it would be easier to hardcode the dates than write code to calculate them.

0

No, it isn't.

I believe your better solution is to code a simple plugin which converts a date into a season and vice-verse. You can provide as parameters:

  • season;
  • start or end;
  • hemisphere;

Or something like that and use the returned value to fill the parameters start_on and ´stop_before`.

5
  • Wish I could, Robson. I assumed there's a swiss army knife add-on in the #eecms community which can be tinkered to do this.
    – Nutmeg
    Jun 24 '14 at 20:09
  • @Nutmeg, this is a very, very, very specific need. I never even thought about something like this. --- Why can't you code this by yourself? Apart from the impossible precision, due to the season change every year, this plugin can be done easily.
    – Sobral
    Jun 24 '14 at 20:31
  • How would you define the start/end of seasons normally (i.e. not in code)?
    – foamcow
    Nov 22 '14 at 0:49
  • @foamcow, are you asking me or him?
    – Sobral
    Nov 22 '14 at 12:28
  • I was asking the original poster. But anyone could answer :)
    – foamcow
    Nov 22 '14 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.