Hi i am working with node.js and kue , i want to delay a job to a future time , what i do is i pass a js date object like this
var today=new Date();
today.setHours(23,00,00);
var email = queue.create('email', {
title: 'Account renewal required'
, to: 'tj@learnboost.com'
, template: 'renewal-email'
}).delay(today)
.priority('high')
.save();
This works well but the job triggers at 7.00 am , that is because my timeZone is UTC + 8 , so the default timezone for the date is UTC .
so
I tried to use moment-timezone module for Node.js and doing something like this .
var today = moment().tz("Asia/Hong_Kong").toDate();
today.setHours(23,00,00);
var email = queue.create('email', {
title: 'Account renewal required'
, to: 'tj@learnboost.com'
, template: 'renewal-email'
}).delay(today)
.priority('high')
.save();
But i found when you use toDate()
it ignores the timezone , so i am stuck here , i searched a lot for 2 days and i couldn't find a solution .
Is there any ways to achieve this , please help me , thanks in advance .