Auto update copyright year range

I have this working example to automatically update the copyright year, but how do I create this using the Properties panel.

© Copyright 2019{{varDate.datetime.formatDate("yyyy") == 2019 ? "" : " - " + (varDate.datetime.formatDate("yyyy"))}}

4 Likes

this is nice and should be in some „Snippets“ shared online within the Community with a star rating :grin::star::star::star::star::star:

Maybe here in Forum as : Docs->Snippets

1 Like

Thank you Freddy, it’s very simple and have been using it for a while now, replacing tte PHP (and sometimes jQuery) code. But it can only be Wappler certified when it is created using Wappler. :frowning_face:

Hi Ben,
Why not using PHP for that?

1 Like

Hi Teodor,

I have alternated between using PHP and JavaScript for this. The great part with using JS is that I no longer have to use the PHP extension for my documents.

Above all, I want to Wapplerise all of my projects. :heart_eyes:

2 Likes

See Automatic update of copyright date

1 Like

Great ‘Wapplerized’ tutorial Ben!

Here’s my quick one… :blush:

<a class="text-muted small" href="//blaxstudios.com"> © 2009 — <?php echo date("Y"); ?>

You can also use JavaScript when you don’t have PHP on your server.

© Copyright <script>document.write((new Date()).getFullYear())</script>

If you don’t like using document.write or want more control

© Copyright 2019<span id="copy"></span>
<script>
var currentYear = (new Date()).getFullYear();
if (currentYear > 2019) {
  document.getElementById('copy').textContent = ' - ' + currentYear;
}
</script>

And the Wappler or App Connect way

© Copyright {{ "now".formatDate("yyyy") }}
1 Like

I personally use the Wappler way. Mostly because it takes literally seconds to add in Wappler.

1 Like