summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMike Mason <ms13sp@gmail.com>2007-11-23 22:38:25 +0000
committerMike Mason <ms13sp@gmail.com>2007-11-23 22:38:25 +0000
commitc81b1c6057a070d7668f81f32d4182e56e753df1 (patch)
tree46147cf41dcf7eac5a2c49bcce6c06d16a23da8a /lib
parentbf5d83c373f610aea01220b74b77590bdf0a473f (diff)
downloadacf-core-c81b1c6057a070d7668f81f32d4182e56e753df1.tar.bz2
acf-core-c81b1c6057a070d7668f81f32d4182e56e753df1.tar.xz
Adding date and time functionality
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@364 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib')
-rw-r--r--lib/README21
-rw-r--r--lib/date.lua55
2 files changed, 73 insertions, 3 deletions
diff --git a/lib/README b/lib/README
index cbc9798..038ec0d 100644
--- a/lib/README
+++ b/lib/README
@@ -1,3 +1,18 @@
-In the process of cleaning up...
-shell libs are no longer used, just keeping them for historical reference at this point
-lua libs are being worked on.
+Brief discription of libs so far. For more info see
+http://wiki.alpinelinux.org/w/index.php?title=ACF_Libraries
+
+date.lua - Date and Time functions
+fs.lua - Many file type functions. May need to be renamed
+join.lua - Takes a table and given a delimeter makes it into a string
+pidof.lua - Process libraries not provided by LPOSIX
+split.lua - Take a delimeted string and makes it into a table
+date.lua - Date and Time lua functions
+
+validator.lua - Validate web input for ACF.
+html.lua - Helps with form building in ACF
+menubuilder.lua -Helps create the menus on left window in ACF
+web_elements.lua - More web functionality for ACF
+privsep.lua - Helps with authorization with ACF
+session.lua -Helps with Session mangement in ACF
+
+These are currently being worked on. Also we use Lua Posix for the rest of the functionality.
diff --git a/lib/date.lua b/lib/date.lua
new file mode 100644
index 0000000..d588ecc
--- /dev/null
+++ b/lib/date.lua
@@ -0,0 +1,55 @@
+--date and time functions
+
+
+module(..., package.seeall)
+
+require("posix")
+
+months ={ {"January","Jan"},
+ {"February", "Feb"},
+ {"March","Mar"},
+ {"April", "Apr"},
+ {"May","May"},
+ {"June","Jun"},
+ {"July","Jul"},
+ {"August","Aug"},
+ {"September","Sep"},
+ {"October","Oct"},
+ {"November","Nov"},
+ {"December","Dec"}
+ }
+-- i am sure there is a better way to do this than a new table
+
+revmonths = {["January"] = 1, ["Jan"] = 1,
+ ["February"] = 2, ["Feb"] = 2,
+ ["March"] = 3, ["Mar"] = 3,
+ ["April"] = 4, ["Apr"] = 4,
+ ["May"] = 5,
+ ["June"] = 6, ["Jun"] = 6,
+ ["July"] = 7, ["Jul"] = 7,
+ ["August"] = 8, ["Aug"] = 8,
+ ["September"] = 9, ["Sep"] = 9,
+ ["October"] = 10, ["Oct"] = 10,
+ ["November"] = 11, ["Nov"] = 11,
+ ["December"] = 12, ["Dec"] = 12
+ }
+
+--give a search number and return the month name
+
+function num_month_name (search)
+ return months[search][1]
+end
+
+--give a search number and return the month abr
+
+function num_month_name_abr (search)
+ return months[search][2]
+end
+
+function name_month_num (search)
+ return revmonths[search]
+end
+
+function abr_month_num (search)
+ return revmonths[search]
+end