cal badge

node v10.16.3
version: 0.0.0
endpointsharetweet
/* * USAGE * */ exports.endpoint = async function (req, res) { try { const [month, day, year] = (new Date).toLocaleDateString('en-US', { timeZone: req.url.replace('/', '') || undefined }).split('/') send(res, { subject: year, status: (month + '-' + day), color: 'blue' }) } catch (e) { if (e instanceof RangeError) { send(res, { subject: 'cal badge', status: 'unknown timezone', color: 'grey' }) } else { send(res, { subject: 'cal badge', status: e.toString(), color: 'grey' }) } } } const send = (res, json) => res.end(JSON.stringify(json, null, 2))
Loading…

no comments

    sign in to comment