[2025-04-13] Send full time string in Javascript
This commit is contained in:
parent
3c561b7975
commit
b04e4b078a
@ -1,18 +1,18 @@
|
||||
<html>
|
||||
<div style="visibility: hidden">
|
||||
<form id="form" method="POST" action="/">
|
||||
<input name="timestamp" id="timestamp" type="number"></input>
|
||||
<input name="date" id="date" type="text"></input>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
<script>
|
||||
window.onload = function(e){
|
||||
var d = new Date();
|
||||
var timestamp = Math.round(d.getTime() / 1000);
|
||||
input = document.getElementById("timestamp")
|
||||
input.value = timestamp;
|
||||
var date = d.toUTCString();
|
||||
dateform = document.getElementById("date")
|
||||
dateform.value = date;
|
||||
form = document.getElementById("form")
|
||||
form.submit();
|
||||
console.log(timestamp);
|
||||
console.log(iso);
|
||||
}
|
||||
</script>
|
||||
|
@ -175,7 +175,8 @@ def getHomoSapiens(yearPercent):
|
||||
return f"Homo Sapiens have been around for ~{-math.floor(yearsUntilHumans)} years"
|
||||
|
||||
def getTemplate(timestamp):
|
||||
now = datetime.datetime.fromtimestamp(timestamp)
|
||||
# Tue, 22 Nov 2011 06:00:00 GMT
|
||||
now = datetime.datetime.strptime(timestamp,"%a, %d %b %Y %H:%M:%S %Z")
|
||||
nowTime = now.strftime("%-I:%M%p")
|
||||
nowDate = now.strftime("%A") + " " + now.strftime("%-d") + " " + now.strftime("%B")
|
||||
|
||||
@ -215,7 +216,7 @@ def index(timestamp):
|
||||
@app.route("/", methods=["GET","POST"])
|
||||
def init():
|
||||
if request.method == "POST":
|
||||
timestamp = int(request.values.get('timestamp'))
|
||||
timestamp = request.values.get('date')
|
||||
return index(timestamp)
|
||||
else:
|
||||
return render_template("init.html")
|
||||
|
Loading…
x
Reference in New Issue
Block a user