chartjs/chartjs-adapter-moment

Week time unit format

stockiNail opened this issue · 8 comments

Having a look to the formats related to the time unit, I see that for week the format is:

week: 'll'

but reading the moment documentation, the format for week should

week: 'w' or week: 'w YYYY

Is there any reason why?

I don't think there is a (good) reason. These are just default formats provided though, everyone can override those at will (in the time scale options)

@kurkle yeah, but being a default, could be better to be correct, isn't it?
If I don't set my format, I'm expecting to have a week representation (whatever it is) and not a day one.
Maybe I'm wrong.

The same for DATEFNS and LUXON adapters.

week has always seemed like a strange unit to me. I could see different people having different expectations as to what's correct. It's not exactly clear to me what you would use this unit for. Can you describe more about your usecase?

@benmccann there are time series where you want see a weekly trend of your data (consumptions of resources, number of calls, transactions). It's not so rare.

Nevertheless, in my opinion, if the "week" time unit is implemented, it should provide the right format, at least that's my expectation.
Of course, the workaround is to set the defaults format on time axis, overriding the default of the adapter but it does not make sense to me (sorry).

Everyone agrees it should provide the right format :-) It's just a question of what the right format is... And unfortunately, there's no one default that will make everyone happy

Seeing a weekly trend of your data makes sense. But is it really generally more useful to have "week 1", "week 2", etc.? I would imagine that "1/3/2018", "1/10/2018", etc. is generally more informative

@benmccann in my opinion, the default format should be "1 2020" (week + year).
For sure there will be someone who doesn't like that format but in that case he/she could change it overriding it on time axis.
It's more or less the same for all the other time units. For instance, I don't like hour with AM or PM (because in my country it's not used) therefore I have to change.
About use case, the week is the last time unit where the real time is well defined (7 days, 24 hours, 60 minutes, 60 seconds, 1000 milliseconds). Furthermore, where you have an application used mainly during the working time (Mon to Fri, 8Am to 5PM), it could be a good compromise to have a look about the real workload of application, without excluding Sat and Sun or nightly hours.

This just seems too much a matter of opinion at the end of the day

For sure there will be someone who doesn't like that format but in that case he/she could change it overriding it on time axis.

That's what I would suggest here instead of changing the default :-)

@benmccann fully agree.
Let me share that in my project I have changed the default for week time unit, overriding the adapters ones because we are going to publish new version in next days:)
Anyway I am gonna fallback if the default will be changed in next version.
Thanks a lot