changeset 1097:b2e4a22ffa5d

fix Time bugs
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 28 Mar 2017 20:58:28 -0600
parents 5dc601c4ed6d
children bae624e455e2
files src/luan/modules/Time.luan
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
diff -r 5dc601c4ed6d -r b2e4a22ffa5d src/luan/modules/Time.luan
--- a/src/luan/modules/Time.luan	Sun Mar 05 15:25:23 2017 -0700
+++ b/src/luan/modules/Time.luan	Tue Mar 28 20:58:28 2017 -0600
@@ -35,7 +35,7 @@
 		local fld = fields[v]
 		fld or error("invalid field: "..v)
 		local n = cal.get(fld)
-		if fld == "month" then
+		if v == "month" then
 			n = n + 1
 		end
 		rtn[i] = n
@@ -52,7 +52,7 @@
 function Time.on( year, month, day, hour, minute, second, millis )
 	month = month - 1
 	local cal = Calendar.getInstance()
-	cal.setLenient(false)
+--	cal.setLenient(false)
 	cal.set( year, month, day, hour or 0, minute or 0, second or 0 )
 	cal.set( Calendar.MILLISECOND, millis or 0 )
 	return cal.getTimeInMillis()