Parse dates nicely with Moment.js

So we can see them all in a standard format 🙂
This commit is contained in:
Badri Sunderarajan 2021-02-25 15:35:35 +05:30
parent 42bd4de7ad
commit 41a095e465
3 changed files with 10 additions and 3 deletions

View file

@ -1,5 +1,6 @@
const express = require("express") const express = require("express")
const bodyParser = require("body-parser") const bodyParser = require("body-parser")
const moment = require("moment")
const Airtable = require("airtable") const Airtable = require("airtable")
// Let's load some configuration! // Let's load some configuration!
@ -57,8 +58,8 @@ app.post("/edcal", (req, res) => {
articles.push({ articles.push({
title: record.get("Title"), title: record.get("Title"),
author: record.get("Author"), author: record.get("Author"),
due_date: record.get("Due Date"), due_date: moment(record.get("Due Date")).format("DD MMM"),
publish_date: record.get("Publish Date"), publish_date: moment(record.get("Publish Date")).format("DD MMM YYYY"),
in_charge: record.get("In charge"), in_charge: record.get("In charge"),
status: record.get("Status"), status: record.get("Status"),
}) })

View file

@ -11,6 +11,7 @@
"airtable": "^0.10.1", "airtable": "^0.10.1",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"express": "^4.17.1" "express": "^4.17.1",
"moment": "^2.29.1"
} }
} }

View file

@ -273,6 +273,11 @@ mime@1.6.0:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
moment@^2.29.1:
version "2.29.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==
ms@2.0.0: ms@2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"