Streaming live at 10am (PST)

Getting Moment.js to work for date/time

Hey!

I want to create a calendar website with future events. Instead of the date/time showing “9 March” I want it just to say “Tomorrow”.

It was solved in this thread using Moment.js: Language markup that can show dynamic dates in different languages

I don’t really understand what to do to make it work though. If anyone could clarify how to make it work for a beginner of Webflow I’d appreciate it a lot!

Here is my share link: https://preview.webflow.com/preview/testing-085b3f?utm_medium=preview_link&utm_source=dashboard&utm_content=testing-085b3f&preview=89736f06500ac6f8d94d7c3fee0c09f5&mode=preview

Here is link to Moment.js: https://momentjs.com/

And if anyone know how solve my problem using something other than Moment.js, feel free to suggest something else.

Thanks!

Hey @vwis

You need to use the .calendar(); function, then add 1 day.

Here’s a working example;

// get tomorrow and remove time from date.
var tomo = moment().add(1, 'days').calendar().split(" at")[0]; 

//log output
console.log(tomo);

Hey Ricky! Thanks for your response. Where do I put this code? Would you be able to share a link to a project where it’s working?

1 Like

I’m in the same boat. Trying to make MomentJS work on Webflow as a total noob. Anything on your side since you posted?