Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions tools/mdParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ const MONTHS_SHORTNAMES = MONTHS_NAMES.map((m) => m.slice(0, 3));

const getTimeStamp = (year,month,day) => new Date(Date.UTC(year,month,day,0,0,0)).getTime()

const formatDateHumanReadable = (timestamp) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scraly what do you think about the human readable format to use? we can go more humans readable here, and probably in the cfp generation too.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the humanreadable data can cause troubles about the dates cause by timezones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the CFP it could, but in the event dates it is always local time respect to the event location.

const date = new Date(timestamp);
const year = date.getUTCFullYear();
const month = MONTHS_NAMES[date.getUTCMonth()];
const day = date.getUTCDate();
return `${month.charAt(0).toUpperCase() + month.slice(1)}-${day}-${year}`;
}

const parseTags = () => {
try {
const tagsContent = fs.readFileSync(TAGS_INPUT, 'utf8');
Expand Down Expand Up @@ -118,13 +126,18 @@ const extractEvents = (monthMarkdown, year, month) => {
: "";
const misc = miscContent.replace(sponsoringLink, "").replace(cfpLink, "").trim();

const dateArray = getTimeSpan(
year,
month,
eventLine.trim().replaceAll(/^\s*\*\s*([0-9\/-]*).*$/g, "$1")
);

const event = {
name: eventLine.trim().replaceAll(/^.*[?0-9\/\-]+.*\[(.*)\].*$/g, "$1"),
date: getTimeSpan(
year,
month,
eventLine.trim().replaceAll(/^\s*\*\s*([0-9\/-]*).*$/g, "$1")
),
date: dateArray,
humanReadableDate: dateArray.length === 1
? formatDateHumanReadable(dateArray[0])
: `${formatDateHumanReadable(dateArray[0])} - ${formatDateHumanReadable(dateArray[1])}`,
hyperlink: eventLine.trim().replaceAll(/^.*\]\(([^)]*)\).*$/g, "$1"),
location: eventLine
.trim()
Expand All @@ -137,7 +150,7 @@ const extractEvents = (monthMarkdown, year, month) => {
.replaceAll(/ \& Online/g, "")
.replaceAll(/^([^(]*)\(.*$/g, "$1")
.trim(),
country: eventLine
country: eventLine
.trim()
.replaceAll(/^[^\]]*[^)]*[\P{Letter}]*([^<]*).*$/ug, "$1")
.trim()
Expand Down