diff --git a/src/_filters/date.js b/src/_filters/date.js index 4667c37..9a8bc3d 100644 --- a/src/_filters/date.js +++ b/src/_filters/date.js @@ -1,5 +1,5 @@ -const dateTime = require('moment') +const { DateTime } = require('luxon') module.exports = (date, format) => { - return dateTime(date).format(format) + return DateTime.fromISO(date).toFormat(format) } diff --git a/src/_layouts/game.njk b/src/_layouts/game.njk index ba602ac..8c9af28 100644 --- a/src/_layouts/game.njk +++ b/src/_layouts/game.njk @@ -5,10 +5,10 @@ layout: base.njk

{{ title }}

-

{{ date | date('ddd DD MMM') }}

+

{{ date | date('ccc d LLLL') }}

- {{ date | date("h:mma") }} - –{{ endDate | date("h:mma") }} + {{ date | date('h:mma') }} + –{{ endDate | date('h:mma') }}

diff --git a/src/_layouts/games.njk b/src/_layouts/games.njk index e929125..de54438 100644 --- a/src/_layouts/games.njk +++ b/src/_layouts/games.njk @@ -23,10 +23,10 @@ layout: base.njk {% if showDate(game.data.date, loop.index0, collections[tag]) %} - {{ game.data.date | date('ddd DD MMM') }} + {{ game.data.date | date('ccc d LLLL') }} {% endif %} - - + + {{ game.data.date | date('H:mm') }} diff --git a/src/_methods/IcalTemplate.js b/src/_methods/IcalTemplate.js index 0ba25b2..4080beb 100644 --- a/src/_methods/IcalTemplate.js +++ b/src/_methods/IcalTemplate.js @@ -1,4 +1,4 @@ -const dateTime = require('moment') +const { DateTime } = require('luxon') const absoluteUrl = require('../_filters/absoluteUrl') module.exports = class @@ -24,7 +24,7 @@ module.exports = class } date (date) { - return dateTime(date).format('YYYY-M-D-H-m').split('-').map(a => parseInt(a, 10)) + return DateTime.fromISO(date).toFormat('y-LL-d-H-mm').split('-').map(a => parseInt(a, 10)) } description (game) { diff --git a/src/_methods/showDate.js b/src/_methods/showDate.js index 3cbfefd..9e6b57f 100644 --- a/src/_methods/showDate.js +++ b/src/_methods/showDate.js @@ -1,4 +1,4 @@ -const dateTime = require('moment') +const { DateTime } = require('luxon') module.exports = (date, index, collection) => { const prevIndex = index - 1 @@ -9,5 +9,5 @@ module.exports = (date, index, collection) => { const prevDay = collection[prevIndex].data.date - return dateTime(prevDay).format('ddd DD MMM') !== dateTime(date).format('ddd DD MMM') + return DateTime.fromISO(prevDay).toLocaleString(DateTime.DATE_SHORT) !== DateTime.fromISO(date).toLocaleString(DateTime.DATE_SHORT) } diff --git a/src/index.njk b/src/index.njk index 6bde80f..0a63992 100644 --- a/src/index.njk +++ b/src/index.njk @@ -23,7 +23,7 @@ title: Football times in your calendar

  • {{ competition.title }}

    -

    {{ competition.start | date("DD MMM") }}–{{ competition.end | date("DD MMM YYYY") }}

    +

    {{ competition.start | date('d LLLL') }}–{{ competition.end | date('d LLLL yyyy') }}

  • {% endfor %}