Skip to content

Commit 2bc8008

Browse files
committed
Add new option to override date display.
1 parent 5b6bce1 commit 2bc8008

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ In any template, drop in the following line to include the output from this plug
3232
If you want to modify the wrapper HTML element, change the wrapper class, or output the date information in a custom format, you can configure this using the included plugin options. Date formatting follows the [available format options from PHP](https://www.php.net/manual/en/function.date.php).
3333

3434
'scottboms.microseasons' => [
35-
'wrapper' => 'div',
35+
'wrapper' => 'div', // e.g. div, article, section, span, etc.
3636
'class' => 'microseasons',
37-
'dateformat' => 'M d, Y'
37+
'includedates' => True, // True | False
38+
'dateformat' => 'M d, Y' // e.g. 'M d', 'Y-m-d', etc.
3839
],
3940

4041
## Disclaimer

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "scottboms/microseasons",
33
"description": "Kirby Micro Seasons plugin",
44
"type": "kirby-plugin",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"homepage": "https://github.com/scottboms/kirby-microseasons",
77
"authors": [
88
{
@@ -14,9 +14,9 @@
1414
"license": "MIT",
1515

1616
"keywords": [
17-
"kirby3",
18-
"kirby3-cms",
19-
"kirby3-plugin"
17+
"kirby",
18+
"kirby-cms",
19+
"kirby-plugin"
2020
],
2121
"require": {
2222
"getkirby/composer-installer": "^1.1"

index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Kirby Japanese Microseasons Plugin
77
*
8-
* @version 1.0.0
8+
* @version 1.0.1
99
* @author Scott Boms <[email protected]>
1010
* @copyright Scott Boms <[email protected]>
1111
* @link https://github.com/scottboms/kirby-microseasons
@@ -23,6 +23,7 @@
2323
'options' => [
2424
'wrapper' => 'div',
2525
'class' => 'microseasons',
26+
'includedates' => True,
2627
'dateformat' => 'M d'
2728
],
2829
'snippets' => [

snippets/microseasons.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
<?= $matchSeason['translation'] ?>
1212
<?= $matchSeason['name'] ?>
1313
</span>
14-
<time class="ms__range" datetime="<?= $matchSeason['start'] ?>/<?= $matchSeason['end']?>">
15-
<?= $matchSeason['start']->format(option('scottboms.microseasons.dateformat', 'M/d')) ?> to <?= $matchSeason['end']->format(option('scottboms.microseasons.dateformat', 'M/d')) ?>
16-
</time>
14+
<?php if(option('scottboms.microseasons.includedates') === True): ?>
15+
<time class="ms__range" datetime="<?= $matchSeason['start'] ?>/<?= $matchSeason['end']?>">
16+
<?= $matchSeason['start']->format(option('scottboms.microseasons.dateformat', 'M/d')) ?> to <?= $matchSeason['end']->format(option('scottboms.microseasons.dateformat', 'M/d')) ?></time>
17+
<?php else: ?>
18+
<?php endif ?>
1719
</dd>
1820
</dl>
1921
</div>

0 commit comments

Comments
 (0)