Missing Intl support in Realm Functions

Hello and a happy and hopefully healthy 2022 to you all! :slightly_smiling_face:

I am despirately trying to work with dates with timezone support in Realm functions. Unfortunately I always get the error “Intl is not defined”, meaning the node environment is lacking support of DateTime standard functions.

I`ve tried different polyfills via npm as a workaround, but without any luck.

Is there a security concern, which led you to disable / not support Intl in the functions environment or could this maybe be enabled in a future version of the functions?

Intl seems like a fairly common package and is supported by most browsers and by node since v6. What I’ve tried so far:

  • luxon
  • moment
  • moment-timezone
  • Intl polyfill
  • full-icu polyfill

If the issue could not be resolved, I’d have to look for other alternatives (lambda, netlify, etc.), but that would contradict the value of the MongoDB eco system. :slightly_smiling_face: Especially since other packages are working just fine.

Could you please help me or point me in the right direction?

Thanks in advance!
Best
Mathias

Hello @Mathias_Gerdt,

Welcome to Community Forums :slight_smile:

We have an ongoing project for supporting timezones. Could you please share a code snippet that could help us know what you are trying to do?

I look forward to your response.

Kind Regards,
Henna

1 Like

Hello Henna,
thank you for your reply!

A basic example is this:

const {DateTime} = require('luxon');
let dt = DateTime.now().setZone('Europe/Berlin').toISO();

We are trying to calculate time differences of JS date objects across timezones, because we are building a rather complex crew scheduling system.

Talking about the ongoing project, will there be a major change or is there maybe even a quick fix? Maybe another underlying node environment with Intl support as flag enabled?

We would like to use the luxon library in realm functions, maybe there’s another workaround for timezone support?

Thanks in advance! Looking forward to hearing from you.
Best
Mathias