The company I work for has employees all over the world, so I thought it'd be fun to make a Time Zone script in Kit.
Here is the code...
// Menu: Time Zones// Description: List of world times// Author: Elijah Manor// Twitter: @elijahmanorconst ct = await npm('countries-and-timezones');const scriptDB = db('timezone', { recents: [] });const timeZones = ct.getAllTimezones();const now = new Date();const addToRecents = async () => {const items = Object.keys(timeZones).map((name) => {const country = ct.getCountry(timeZones[name].country);if (!country) {return null;}return {name: `${name} (${country.name})`,value: name,description: `${now.toLocaleTimeString('en-US', {hour: '2-digit',timeZone: name,minute: '2-digit',hour12: true,weekday: 'short',month: 'short',day: 'numeric',})} (${timeZones[name].utcOffsetStr})`,};}).filter((x) => x);const timeZone = await arg('Select to add to recents...', items);const recents = scriptDB.get("recents").value();recents.push(items.find((t) => t.value === timeZone));scriptDB.set("recents", recents).write();};const removeFromRecents = async () => {let recents = scriptDB.get('recents').value();const timeZone = await arg('Select to remove from recents...', recents);recents = recents.filter((r) => r.value !== timeZone);scriptDB.set('recents', recents).write();};onTab('Search', addToRecents);onTab('Recent', removeFromRecents);