Moment doesn't seem to be parsing my date calculations correctly

The code is suppposed to receive the age of a baby and make sure that it’s not a date in the future and that the baby is not older than 2 years old. import moment from "moment"; function datevalidation(baby_dob, current_date, diff) { if ( !baby_dob.isBetween(current_date, current_date.clone().subtract(2, "years")) ) { if (diff > 0) { return… Read More Moment doesn't seem to be parsing my date calculations correctly

Using moment.js Timezone to set starting timezone and converting to other timezones

I’m following an example from https://www.alex-arriaga.com/how-to-set-moment-js-timezone-when-creating-a-date/ but not getting the results I’m expecting. My startDateAndTimeString has the time set to 08:00 and I set the timezone to Mexico_City which is in CST. Then I’m trying to convert to New_York (EST) and Los_Angeles (PST) time. I would expect if the starting time is 08:00 CST then… Read More Using moment.js Timezone to set starting timezone and converting to other timezones

Countdown based on timezone with jQuery

I worked with this: (function() { var timeElement, eventTime, currentTime, duration, interval, intervalId; interval = 1000; // 1 second // get time element timeElement = document.querySelector(“#countdown”); // calculate difference between two times eventTime = moment.tz(“2022-05-29T08:00:00”, “Europe/Berlin”); // based on time set in user’s computer time / OS currentTime = moment.tz(); // get duration between two… Read More Countdown based on timezone with jQuery