Last modified: 2014-08-06 15:49:11 UTC
I found that frequently I need to get time table (a table with fields "year", "month", ...) of a timestamp in the wiki's local time. It is not possible to obtain this table via os.date() because the function can't accept timestamp as a parameter, and the function also can't deal with the wiki's local time. The workaround is to do something like: timetable = { year = tonumber(lang:formatDate(...)), month = tonumber(lang:formatDate(...)), day = tonumber(lang:formatDate(...)), hour = tonumber(lang:formatDate(...)), ... } which is redundant and ridiculous. I therefore propose that timetable can be obtained via lang:formatDate('*t', timestamp, local).
There should be some way to get time components in the wiki's local timezone, yes. But I don't think that '*t' to formatDate is the best way to do it. The ideal would be to fix os.date to use the wiki local time instead of the server local time when in local-time mode, IMO. But if that's prohibitively difficult, either something that fits in better with the formatDate interface or a separate function to get the array (IMO the latter is more likely).
With os.date(), the second parameter must be value from os.time() or nil; it can't accept '-7 days' or '@1407339935' like lang:formatDate(). However, I don't oppose if you think that changing os.date() is more proper.