Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use utcOffset #568

Closed
arnitkun opened this issue May 22, 2021 · 6 comments · Fixed by #685
Closed

unable to use utcOffset #568

arnitkun opened this issue May 22, 2021 · 6 comments · Fixed by #685
Labels
type:bug Bug reports and bug fixes

Comments

@arnitkun
Copy link

arnitkun commented May 22, 2021

I have a job

someJob = new CronJob( '0 ${minutes} ${hours} * * ${targetday}', async () => { // job stuff }, null, null, null, null, null, '5:30', null, );

i also start the job.

I have also tried giving the constructor an object with key-value pairs; cronTime, onTick ...etc etc.

But the utcOffset does not work and I am unable to figure out why. If i use the same job in a scenario that does not require me
to use offset, it works fine.

I am unable to find this in ANY code example except in a couple of git issues and even those do not work for me.
have tried giving numbers and string as offset.

Can someone show me a practical example? i have spent hours trying to make it work. also getting no errors.

@arnitkun
Copy link
Author

I ended up writing my own function to calculate time with offsets.

@dummy-account-practise
Copy link

I ended up writing my own function to calculate time with offsets.

Hi! I'm facing the same issue. Will you please help me out how you've resolved it?

Thanks in advance :)

@intcreator
Copy link
Collaborator

FYI this is addressed in #652

@AbhimanyuG
Copy link

AbhimanyuG commented Mar 8, 2023

The issue still exists. Even though I set the offset as 330 (5 hr 30 min ahead of UTC)
Input offset:

 { offset: 330 }

From modified time.js

 if (typeof this.utcOffset !== 'undefined') {
    ... skipped ...
console.log({utcZone})
date = date.setZone(utcZone);

Output:

{ utcZone: 'UTC+5' }

This is just some debugging info from my console. The UTC string should've been 'UTC+5:30'

@AbhimanyuG
Copy link

Potential fix:
AbhimanyuG@3364420

@intcreator
Copy link
Collaborator

@AbhimanyuG thanks for the PR! I left a comment for you there 🙂

@sheerlox sheerlox added the type:bug Bug reports and bug fixes label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Bug reports and bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants