Coding a Timezone Conversion Plugin for WordPress Using AI

Coding a Timezone Conversion Plugin for WordPress Using AI

There are a lot of claims that AI can replace developers, and so I wanted to see exactly what it was capable of. Based on my experiment, it is not there yet, but it is damn handy.

In this post, I want to run you through that experiment and show you exactly what AI (in my case, Claude 3.5 Sonnet) is capable of.

What I Was Looking to Achieve

I decided I wanted to build a simple WordPress plugin. I wanted it to take a shortcode and output the time in somebody’s local timezone.

So turn this:[timezone time="17:00" zone="Europe/London" into: "6PM Paris Time".

My Initial Prompt

I started by asking the following.

I want to work on a project. The goal is to create a WordPress plugin that takes a shortcode of a time and displays that time to the user in their local timezone. I was thinking the shortcode might look something like [timezone time="17:00" zone="Europe/London"] Are you ready or do you have questions?

It did indeed ask some questions:

  • Do you want the plugin to automatically detect the user's time zone? - To which I responded, "Yes."
  • Should the output format be customizable? - I decided to keep things simple, so I answered no.
  • Do you want to handle Daylight Saving Time (DST) changes? - In this case, I answered yes.
  • Do you have a preference for how to handle potential errors, such as invalid time formats or time zones? - I asked that it would just output the time shown in the shortcode.

First Attempt

Its first attempt completely sucked. It used PHP to look up the server time, rather than the local time of the client. However, when I pointed this out, it quickly changed approach.

It worked out that it could use Moment.JS to look up the timezone and do all the conversion work. It also wrote both the PHP and JS to make the plugin.

I downloaded the files individually, and I then zipped them up (for some reason it couldn’t zip them for me, unlike ChatGPT) so I could upload them to my website.

Unfortunately, it didn’t work.

Second Attempt

After telling Claude that things weren’t working, it attempted to guide me through some debugging using the developer tools in Chrome.

To be honest, this is the point where somebody with zero coding experience would give up. My coding skills are very rusty, and I only have a very rudimentary understanding of PHP and JavaScript. However, I am not intimidated by the console and other developer tools.

I uploaded a couple of screenshots from the developer tools, and it tried its best to work out the issue. In the end, I found that my browser was blocking the moment.js files. They were being loaded by a CDN, not served locally.

I explained the problem to Claude and it had its third attempt.

Third Attempt

This time it decided to install moment.js from the CDN locally when you install the plugin. This was fine, although this has a danger of breaking the plugin at some point in the future. However, for the purpose of this test I let it go.

It outputted the updated files, and I installed the plugin again. It still didn’t work.

Final Few Tweaks

Turns out we both made one dumb error each.

I failed to put the JavaScript file in the sub-folder it had specified. That was my bad.

Meanwhile, it had, for some reason, named that same file something completely different from the name it had specified in the code. That took me a while to spot, and it seemed oblivious to the fact too.

Once those issues were fixed, it finally worked. The entire exercise took about 50 minutes.

Conclusion

So can AI replace the need for a developer? Absolutely not. However, it does allow somebody with at least some development experience to do things that would previously have been out of reach to them.

But it is also dangerous. This test plugin could have security flaws, performance issues, or poor error handling that I might not know about.

Sure, I could probably ask Claude to help me identify and address them, but that relies on me being informed enough to know to ask.

We will still need experts to ask the right questions. AI will be just a handy tool for a while yet.

Because Somebody Will Ask

Finally, I know somebody will ask me to share the plugin, so here it is. Use it at your own risk!

To view or add a comment, sign in

More articles by Paul Boag

  • Why UX Teams Need a Maturity Audit Right Now

    UX is under pressure. A proactive maturity audit gives you a voice before leadership makes decisions about your team…

    1 Comment
  • Democratizing UX with AI

    Most UX teams are too small to shape the whole experience. An organizational AI skills library might be the answer.

    2 Comments
  • Your AI Toolkit Is Your Competitive Edge

    Building a personal library of AI skills is the investment that separates the professionals who'll thrive from those…

  • Generative UI: useful, or just chaos with better branding?

    It can personalize and reduce friction. It can also wreck consistency and muscle memory.

    2 Comments
  • Can AI Design a UI Yet? (And Why Designers Are Still Needed)

    AI can design something adequate. It still struggles with context, trade-offs, and taste.

    5 Comments
  • Is your website copy faceless?

    Is your website copy invisible? Three quick tests to find out if your headlines are too generic to differentiate you…

    3 Comments
  • It’s all interconnected

    Why CRO, UX design, and design leadership aren't separate disciplines. They're three interconnected pieces that make…

    2 Comments
  • Why I'm Not Worried About My AI Dependency

    Should we worry about over-relying on AI? After becoming completely dependent on it, I think we're asking the wrong…

    18 Comments
  • Framing my thoughts on AI and pricing models

    AI has thrown a spanner in my hourly rate thinking. Here's why I'm reconsidering fixed-price projects and where my head…

    2 Comments
  • Stuck in a Website Fixing Loop? Try This.

    Fixing a broken website means inheriting all the reasons it broke. Try starting from nothing instead.

Others also viewed

Explore content categories