1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-03 20:58:39 -04:00

testing: Add tests for Lua dates

Also fix a timezone bug discovered while testing
This commit is contained in:
2017-11-07 05:58:58 -05:00
parent 6115a16f89
commit 5daed2f508
2 changed files with 33 additions and 1 deletions

View File

@ -63,9 +63,10 @@ func luaWeakCheckTableFieldInt(L *lua.LState, T *lua.LTable, n int, name string,
}
func luaDateNew(L *lua.LState) int {
// TODO make this track the user's timezone
v := L.Get(1)
if s, ok := v.(lua.LString); ok {
date, err := time.Parse(timeFormat, s.String())
date, err := time.ParseInLocation(timeFormat, s.String(), time.Local)
if err != nil {
L.ArgError(1, "error parsing date string: "+err.Error())
return 0