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

Silence "TZID without Luxon available is unsupported" logs #441

Closed
7 tasks
GearoidCollins opened this issue Dec 7, 2020 · 2 comments
Closed
7 tasks

Silence "TZID without Luxon available is unsupported" logs #441

GearoidCollins opened this issue Dec 7, 2020 · 2 comments

Comments

@GearoidCollins
Copy link

Reporting an issue

Love the package but v2.6.6 has introduced a lot of noise in our logs. I've also gone ahead and added Luxon as a dependency but am still receiving the warning.

We're using fromString which has a tzid already in it.

1

Thank you for taking an interest in rrule! Please include the following in
your report:

  • Verify that you've looked through existing issues for duplicates before
    creating a new one
  • Code sample reproducing the issue. Be sure to include all input values you
    are using such as the exact RRule string and dates.
  • Expected output
  • Actual output
  • The version of rrule you are using
  • Your operating system
  • Your local timezone (run $ date from the command line
    of the machine showing the bug)
@dereekb
Copy link
Contributor

dereekb commented Jul 8, 2021

Just ran into this. Using date-fns instead of Luxon and would rather use date-fns to handle conversions.

Since the maintainers are absence I created a "patch" to silence it.

function SILENCE_CONSOLE_ERROR_PATCH() {
    const origError = console.error;

    console.error = function () {
      const message = arguments[0];

      if (message !== 'Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone') {
        origError.apply(this, arguments);
      }
    }
  }

I understand that the error is there to make sure the user avoids unintentional behavior, but the example in the README seems to allow it without the results referencing Luxon.

https://github.com/jakubroztocil/rrule/tree/286422ddff0700f1beb2e65cebff3421cc698aac#important-use-utc-dates

const rule = RRule.fromString(
  "DTSTART;TZID=America/Denver:20181101T190000;\n"
  + "RRULE:FREQ=WEEKLY;BYDAY=MO,WE,TH;INTERVAL=1;COUNT=3"
)
rule.all()

...

// You can get the local components by using the getUTC* methods eg:
date.getUTCDate() // --> 1
date.getUTCHours() // --> 18

Need to add a static flag or some other configuration to RRule to allow silencing it manually, or the library needs a better way of providing a date conversion.

@davidgoli
Copy link
Collaborator

Luxon is no longer used as of 2.7.0

@dereekb dereekb mentioned this issue Jun 10, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants