I'm using moment-timezone@0.5.23
.
const moment = require('moment-timezone');
...
const now = moment().tz('America/Los_Angeles');
console.log(now.format('dddd');
This works well when I run it on my laptop. However, when I deploy the code to my AWS Lambda function running on Node 8.10, I see this in the log
Moment Timezone has no data for "America/Los_Angeles". See
http://momentjs.com/timezone/docs/#/data-loading/.
As the result, I end up with the time of either America/New_York
or UTC instead of America/Los_Angeles
.
I've tried to copied the packed data over and loaded it manually (moment.tz.load(require('./latest'));
) but still got the same error.
Any way to make moment-timezone
work properly on AWS Lambda?
Thanks,