Improve `os.date` / `strftime`
The implementation of os.date didn't support many flags that I was used to from other systems. This new implementation supports many more of the flags from the C standard for strftime, plus some utilities borrowed from other strftime implementations such as glibc and Ruby.
The overall changes are:
- Added the following flags unchanged from the C spec:
%n,%t,%j,%e,%D,%r,%R,%T,%G,%g,%V -
%xwas just wrong; it formatted a time as if it was a date. It has now been defined to be the same as%D. - Added:
-
%-m: trimmed month -
%-d: trimmed day of month
-
I see that this flag-scanning code is also used by strGsubStr. Please do let me know if my changes are unacceptable because of that!
Would like to know when this will get merged. My Lua code uses os.date but %a is not formatted correctly in the current gopher-lua codebase and will always result in "mon" instead "Mon" or any other correct day for that matter. I was going to submit a fix for that bug myself, but then this PR came along and now I am just waiting for it to get merged.