1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { email } from "https://esm.town/v/std/email?v=9";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function quote_of_the_day() {
const [qod] = await fetchJSON(
"https://zenquotes.io/api/today",
);
const formattedQuote = `"${qod.q}"
${qod.a}`;
const today = new Intl.DateTimeFormat("it-IT", {
year: "numeric",
month: "2-digit",
day: "2-digit",
}).format(new Date());
const subject = `Quote of the day - ${today}`;
await email({ text: formattedQuote, subject });
return subject;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
February 16, 2024