chartjs / chartjs-adapter-luxon

Luxon adapter for Chart.js
MIT License
33 stars 24 forks source link

Object parsing ignores the user options #67

Closed stockiNail closed 1 year ago

stockiNail commented 1 year ago

Developing #66, I have discovered a bug in the parse method of the adapter.

To create a Luxon DateTime object, you must use DateTime.from* methods which are all receiving the options in order to set the locale, zone, numbering and calendar systems.

Currently the adapter is not passing the user options (and therefore it's ignoring it) in the parse method when the value to parse is an object which represents a date time ({ year: ..., month: ..., day:...}). I think this way to map a timestamp is not so used (I have never seen it used with Chart,js), nevertheless, being there, it should be adjusted.

    } else if (type === 'object' && !(value instanceof DateTime)) {
      value = DateTime.fromObject(value);
    }

I'll submit a PR.

EDIT

PR #64 is fixing it.

stockiNail commented 1 year ago

Closed by #64