Skip to content

Commit 93f2846

Browse files
committed
Update docs, release version 3.0.0
1 parent a9078f0 commit 93f2846

24 files changed

+1779
-632
lines changed

.editorconfig

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
# This file is for unifying the coding style for different editors and IDEs
2-
# editorconfig.org
3-
41
[*]
5-
charset = utf-8
6-
indent_style = space
7-
indent_size = 2
82
end_of_line = lf
9-
insert_final_newline = true
3+
charset = utf-8
104
trim_trailing_whitespace = true
11-
12-
[*.php]
5+
insert_final_newline = true
6+
indent_style = space
137
indent_size = 4
8+
max_line_length = 80
149

15-
[*.md,*.txt]
16-
trim_trailing_whitespace = false
17-
insert_final_newline = false
10+
[*.yml]
11+
indent_size = 2
1812

19-
[composer.json]
20-
indent_size = 4
13+
[*.md]
14+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 0 additions & 11 deletions
This file was deleted.

.prettierrc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
{
2+
"bracketSameLine": false,
3+
"bracketSpacing": true,
4+
"htmlWhitespaceSensitivity": "css",
5+
"phpVersion": "8.2",
26
"printWidth": 80,
7+
"proseWrap": "never",
38
"semi": true,
49
"singleQuote": true,
510
"trailingComma": "none",
6-
"bracketSpacing": true,
7-
"jsxBracketSameLine": true,
8-
"phpVersion": "7.3",
9-
"trailingCommaPHP": false
11+
"trailingCommaPHP": false,
12+
"plugins": ["@prettier/plugin-php", "prettier-plugin-css-order"],
13+
"overrides": [
14+
{
15+
"files": "LICENSE.md",
16+
"options": {
17+
"proseWrap": "always"
18+
}
19+
}
20+
]
1021
}

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 hana+nils · Büro für Gestaltung
3+
Copyright (c) hana+nils · Büro für Gestaltung
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![Kirby Date Methods](.github/title.png)
22

3-
Date Methods is a plugin for [Kirby 3](https://getkirby.com) that allows for advanced date and time parsing and formatting using PHP's core date objects. It offers methods for fields to handle single dates, methods for pages to handle multiple dates (ranges) and also provides helper functions to simplify working with dates and times in general.
3+
Date Methods is a plugin for [Kirby](https://getkirby.com) that allows for advanced date and time parsing and formatting using PHP's core date objects. It offers methods for fields to handle single dates, methods for pages to handle multiple dates (ranges) and also provides helper functions to simplify working with dates and times in general.
44

55
## Overview
66

@@ -22,17 +22,13 @@ Converters read a date string and convert it to PHP date and time objects like `
2222
$datetime = $page->date()->toDateTime();
2323

2424
// Modify and format date
25-
$page
26-
->date()
27-
->toDateTime()
28-
->modify('+1 month')
29-
->format('Y-m-d');
25+
$page->date()->toDateTime()->modify('+1 month')->format('Y-m-d');
3026

3127
// Compare a date field to another date
3228
$page
33-
->date()
34-
->toDateDiff('2000-01-01')
35-
->format('The beginning of the century was %y ago.');
29+
->date()
30+
->toDateDiff('2000-01-01')
31+
->format('The beginning of the century was %y ago.');
3632
```
3733

3834
### 2. Formatters
@@ -89,10 +85,7 @@ $published->toFormatted(IntlDateFormatter::LONG, IntlDateFormatter::SHORT);
8985

9086
// Get a user's birthday this year
9187
echo 'Bastian’s birthday is on ' .
92-
$user
93-
->birthday()
94-
->toCurrentYear()
95-
->toFormatted();
88+
$user->birthday()->toCurrentYear()->toFormatted();
9689
```
9790

9891
### 4. Validators
@@ -371,16 +364,14 @@ Converts the given date string to `H:i` format.
371364

372365
There are several options to customize the plugin behaviour:
373366

374-
| option | description | default |
375-
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
376-
| `code` | The locale | `de` |
377-
| `rangeseparator` | The string used to separate a date range, e.g. `01.08.–05.08.24` | `` |
378-
| `datetimeseparator` | The string used to separate date and time, e.g. `01.08., 10:00` | `, ` |
379-
| `datetype` | The date format used. <br/>Must be one of [the predefined constants in IntlDateFormatter](https://www.php.net/manual/en/class.intldateformatter.php#intldateformatter.constants.full) | `IntlDateFormatter::LONG` |
380-
| `timetype` | The time format used. <br/>Must be one of [the predefined constants in IntlDateFormatter](https://www.php.net/manual/en/class.intldateformatter.php#intldateformatter.constants.full) | `IntlDateFormatter::SHORT` |
381-
367+
| option | description | default |
368+
| --- | --- | --- |
369+
| `code` | The locale | `de` |
370+
| `rangeseparator` | The string used to separate a date range, e.g. `01.08.–05.08.24` | `` |
371+
| `datetimeseparator` | The string used to separate date and time, e.g. `01.08., 10:00` | `, ` |
372+
| `datetype` | The date format used. <br/>Must be one of [the predefined constants in IntlDateFormatter](https://www.php.net/manual/en/class.intldateformatter.php#intldateformatter.constants.full) | `IntlDateFormatter::LONG` |
373+
| `timetype` | The time format used. <br/>Must be one of [the predefined constants in IntlDateFormatter](https://www.php.net/manual/en/class.intldateformatter.php#intldateformatter.constants.full) | `IntlDateFormatter::SHORT` |
382374

383375
# License
384376

385-
This plugin is provided freely under the [MIT license](LICENSE.md) by [hana+nils · Büro für Gestaltung](https://hananils.de).
386-
We create visual designs for digital and analog media.
377+
This plugin is provided freely under the [MIT license](LICENSE.md) by [hana+nils · Büro für Gestaltung](https://hananils.de). We create visual designs for digital and analog media.

composer.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
{
22
"name": "hananils/kirby-date-methods",
3-
"description": "Kirby 3 plugin providing field and page methods for formatting dates and creating PHP date objects.",
4-
"type": "kirby-plugin",
3+
"description": "Parsing and formatting dates can be difficult, especially if you deal with multilingual content. Date Methods aims to simplify date output by providing page and field methods to handle points in time as well as date ranges accurately in your snippets and templates.",
54
"license": "MIT",
6-
"version": "2.1.0",
5+
"type": "kirby-plugin",
6+
"version": "3.0.0",
77
"authors": [
88
{
99
"name": "hana+nils · Büro für Gestaltung",
1010
"email": "buero@hananils.de"
1111
}
1212
],
13+
"homepage": "https://kirby.hananils.de/plugins/date-methods",
1314
"require": {
14-
"getkirby/composer-installer": "^1.1",
15+
"php": "^8.2",
1516
"openpsa/ranger": "^0.5.1"
1617
},
18+
"require-dev": {
19+
"ergebnis/composer-normalize": "^2.47",
20+
"rector/rector": "^2.0"
21+
},
22+
"replace": {
23+
"symfony/intl": "*"
24+
},
25+
"suggest": {
26+
"symfony/intl": "~2.6|~3.4|~4.0|~5.0|~6.0|~7.0"
27+
},
1728
"config": {
18-
"optimize-autoloader": true
29+
"allow-plugins": {
30+
"ergebnis/composer-normalize": true
31+
},
32+
"sort-packages": true
1933
}
2034
}

0 commit comments

Comments
 (0)