diff src/luan/modules/http/Http.luan @ 1546:2b4471d310b3

better time zone handling
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 22 Sep 2020 21:41:22 -0600
parents a47021c3da1e
children 153ea3b7afaf
line wrap: on
line diff
--- a/src/luan/modules/http/Http.luan	Sun Sep 20 21:09:19 2020 -0600
+++ b/src/luan/modules/http/Http.luan	Tue Sep 22 21:41:22 2020 -0600
@@ -14,6 +14,8 @@
 local lower = String.lower or error()
 local matches = String.matches or error()
 local trim = String.trim or error()
+local Time = require "luan:Time.luan"
+local time_format = Time.format or error()
 local Boot = require "luan:Boot.luan"
 local LuanJava = require "java:luan.Luan"
 local Request = require "java:goodjava.webserver.Request"
@@ -180,4 +182,8 @@
 
 Http.is_serving = false
 
+function Http.format_date(date)
+	return time_format(date,"EEE, dd MMM yyyy HH:mm:ss 'GMT'","GMT")
+end
+
 return Http