1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-10 23:24:04 +02:00

fix(fields): fix issues with strtotime() function.

This commit is contained in:
Awilum
2020-11-23 09:51:18 +03:00
parent 9901d6d821
commit fdf6d3d833
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ use Atomastic\Strings\Strings;
if (flextype('registry')->get('flextype.settings.entries.fields.created_at.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void {
if (flextype('entries')->getStorage('fetch_single.data.created_at') == null) {
if (flextype('entries')->getStorage('fetch_single.data.created_at') === null) {
flextype('entries')->setStorage('fetch_single.data.created_at', (int) flextype('filesystem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified());
} else {
flextype('entries')->setStorage('fetch_single.data.created_at', (int) strtotime((string) flextype('entries')->getStorage('fetch_single.data.created_at')));
@@ -19,7 +19,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.created_at.enabl
});
flextype('emitter')->addListener('onEntryCreate', static function (): void {
if (flextype('entries')->getStorage('create.data.created_at') == null) {
if (flextype('entries')->getStorage('create.data.created_at') === null) {
flextype('entries')->setStorage('create.data.created_at', date(flextype('registry')->get('flextype.settings.date_format'), time()));
}
});

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
if (flextype('registry')->get('flextype.settings.entries.fields.modified_at.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void {
if (flextype('entries')->getStorage('fetch_single.data.modified_at') == null) {
if (flextype('entries')->getStorage('fetch_single.data.modified_at') === null) {
flextype('entries')->setStorage('fetch_single.data.modified_at', (int) flextype('filesystem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified());
}
});

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
if (flextype('registry')->get('flextype.settings.entries.fields.published_at.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void {
if (flextype('entries')->getStorage('fetch_single.data.published_at') == null) {
if (flextype('entries')->getStorage('fetch_single.data.published_at') === null) {
flextype('entries')->setStorage('fetch_single.data.published_at', (int) flextype('filesytem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified());
} else {
flextype('entries')->setStorage('fetch_single.data.published_at', (int) strtotime((string) flextype('entries')->getStorage('fetch_single.data.published_at')));
@@ -17,7 +17,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.published_at.ena
});
flextype('emitter')->addListener('onEntryCreate', static function (): void {
if (flextype('entries')->getStorage('create.data.published_at') == null) {
if (flextype('entries')->getStorage('create.data.published_at') === null) {
flextype('entries')->setStorage('create.data.published_at', date(flextype('registry')->get('flextype.settings.date_format'), time()));
}
});