Simple Clock Card

Hi.
I have done all your recommendations. The > does not change anything. The manual card I have added to the page shows “No card type found”. The editor adds ’ ’ to the mdi … and to the custom… lines but that does not change anything.
Keep in mind that I use picture element in some of the pages. I placed the new card in a regular page in which all cards are added from the menus and not manually edited to create the picture elements cards.

Ok, then please show your lovelae-code around the card.

Also, I am wondering, have the moment.js and is.js files been downloaded correctly? Some time ago I had the issue that I had thought a js-file had downloaded correctly but when I opened it in an editor I noticed all html-code so I had downloaded the code of the webpage instead.

Hi.

At 1st glance the is.js looks like a js file althought at the beginning the is a piece of something that does not look like a code. I will download it again to verify.
As for the lovalace card, I simply entered the ui edit, moved to the proper page and pressed the + icon and added a manual card with the content I have copied from here.

Hi again.

You are correct. The is.js file was messed up. I have fixed it. Anyway I have noticed the moments.js has to optional files: moments.js and moments with locale. Which one to use?
Anyway it is still in the same condition. It has an error.

Use moments.js, the other one doesn’t work, I tried it.

Can you show the code of your lovelace-card? The error must be in there somewhere.
Maybe I cannot help anymore as I’m using the ui-lovelace.yaml file.

Hi.
Should it be moment.js?
I use both. Some pages are yaml and some are regular card pages. I can move it to the yaml card. Will update and also re-check the tutorial for custom card.

Moment.js, correct :slight_smile:

The js files are placed with the lovaelace raw editor. I do not use YAML (my mistake).
I have tried to put the card into the lovelace code and through the visual UI. Both do not recognise the card.

Please also check the contents of clock-card.js, maybe the content is malformed.

It looks OK.

Just upgraded to 107.0 and moved url: /local/JS/clock-card.js and url: /local/JS/moment.js to the new lovelace dashboards configuration but not working. the other items I had to move such as custom-cards are working. also replaced the clock-card.js to the most recent file, this was working for the last few months.

Hi. Something crossed my mind. I use compact-home so if this might cause the issue.

Sorry, I’m out of ideas how to help you.

Works like a charm. Is there an easy possibility to remove the seconds? I need some space and I prefer a more relaxed clock without chganging every second :wink:

Are you using my version?
If yes, I recently updated my version, removed all the moments-stuff.
Let me know, I’ll tell you how to remove the seconds.

Think so yes. I’m using this:
https://github.com/bouwew/clock-card/tree/patch-1
As suggested i did not use “moments–stuff” :wink:

1 Like

Update: one correction made.

OK, great.

Open your local clock-card.js-file in an editor (I recommend the Visual Studio add-on).
Find this line:

this.time.innerHTML = hours + ":" + minutes + ":" + seconds;

Remove everything between the word “minutes” and the “;” at the end of the line and save the file.
Next, you must clear the browser-cache and reload the page. When using Google Chrome in Windows, press F12, right click on the browser reload button and select “Empty Cache and Hard-Reload”.
Now the seconds should be gone.

Works! Thank you very much for the impressive fast help :+1:

I’m having trouble getting the element to load. it keeps telling me moment is not defined. i’ve tried running this locally as well. any ideas?

Use my version of clock-card, it does not use moments.
See a few posts up, the post by Manuel82, for the link.