Sign In Register

How can we help you today?

Start a new topic



Our cloud code needs to do a lot of date/time processing and we would like to use moment.js. Is it something you would consider to offer in your backend?

3 people like this idea

Yearly bump -- moment is insanely intuitive, quite the opposite of vanilla Dates. You can't manipulate them easy. I pretty much had to write my own library as a module for date/time goodies.

Almost every single top stack overflow answer to any js Date questions will be, "if you have Moment, you can use this single line of code..."

It's easy to add it and won't affect existing customers.

Getting Moment to work is easy enough ... getting moment timezone (which relies on moment) is much harder...


What keeps you from adding Moment.js and other packages as module and using it by require() from there?

I've spent a couple of fruitless days trying to get moment timezone to work in GS cloudcode land to no avail...

moment is a GREAT package. We're having the issue now, too.

We are facing the same problem right now. We decided to let the client do all date/time callculations because it knows it's time zone.

For that we send the clients time zone ID with the account details request and store it in ScriptData. After that every client can do calculations for that player with the time zone ID.

Sadly the TimeZoneInfo class is currently broken in Unity, so you have to implement some workarounds (if you are using unity).

Hi Liam,

The cloud code generates personalized emails to players with event dates. So from a js date and a timezone, I need a human readable date. The main challenge here is to properly support daylight saving time.


We also need to add days to a date. We cannot simply do that: newDate = date + (nbDays * 86400000), we have to consider daylight saving time.


moment.js properly support daylight saving time.

Hi Christian,

What sort of date/time processing required here that can't be done in Cloud Code right now ?



Login to post a comment