mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +09:00
17 lines
504 B
JavaScript
17 lines
504 B
JavaScript
const luxon = require('luxon');
|
|
|
|
const settings = require('../settings');
|
|
|
|
// get post date, optionally formatted as specified in settings
|
|
module.exports = (post) => {
|
|
const dateTime = luxon.DateTime.fromRFC2822(post.pubDate[0], { zone: settings.custom_date_timezone || 'utc' });
|
|
|
|
if (settings.custom_date_formatting) {
|
|
return dateTime.toFormat(settings.custom_date_formatting);
|
|
} else if (settings.include_time_with_date) {
|
|
return dateTime.toISO();
|
|
} else {
|
|
return dateTime.toISODate();
|
|
}
|
|
};
|