diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json index 8a78b7cc6..359942ff1 100644 --- a/backend/i18n/frontend_en.json +++ b/backend/i18n/frontend_en.json @@ -764,6 +764,8 @@ "schemas.fieldTypes.components.description": "Embed other schemas to this content as array.", "schemas.fieldTypes.dateTime.defaultMode": "Default Mode", "schemas.fieldTypes.dateTime.description": "Events date, opening hours.", + "schemas.fieldTypes.dateTime.format": "Pattern", + "schemas.fieldTypes.dateTime.formatHint": "The pattern when shown in the UI, see: https://date-fns.org/v2.22.1/docs/format", "schemas.fieldTypes.dateTime.rangeMax": "Max Value", "schemas.fieldTypes.dateTime.rangeMin": "Min Value", "schemas.fieldTypes.geolocation.description": "Coordinates: latitude and longitude.", diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json index cc11634e1..cdf9da7b7 100644 --- a/backend/i18n/frontend_it.json +++ b/backend/i18n/frontend_it.json @@ -764,6 +764,8 @@ "schemas.fieldTypes.components.description": "Embed other schemas to this content as array.", "schemas.fieldTypes.dateTime.defaultMode": "Modalità predefinita", "schemas.fieldTypes.dateTime.description": "Data degli eventi, orari di apertura.", + "schemas.fieldTypes.dateTime.format": "Pattern", + "schemas.fieldTypes.dateTime.formatHint": "The pattern when shown in the UI, see: https://date-fns.org/v2.22.1/docs/format", "schemas.fieldTypes.dateTime.rangeMax": "Valore Max", "schemas.fieldTypes.dateTime.rangeMin": "Valore Min", "schemas.fieldTypes.geolocation.description": "Coordinate: latitudine e longitudine.", diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json index e5ea8382b..e6a78cec0 100644 --- a/backend/i18n/frontend_nl.json +++ b/backend/i18n/frontend_nl.json @@ -764,6 +764,8 @@ "schemas.fieldTypes.components.description": "Embed other schemas to this content as array.", "schemas.fieldTypes.dateTime.defaultMode": "Standaardmodus", "schemas.fieldTypes.dateTime.description": "Datum van evenementen, openingstijden.", + "schemas.fieldTypes.dateTime.format": "Pattern", + "schemas.fieldTypes.dateTime.formatHint": "The pattern when shown in the UI, see: https://date-fns.org/v2.22.1/docs/format", "schemas.fieldTypes.dateTime.rangeMax": "Max. waarde", "schemas.fieldTypes.dateTime.rangeMin": "Min. waarde", "schemas.fieldTypes.geolocation.description": "Coördinaten: lengte- en breedtegraad.", diff --git a/backend/i18n/frontend_zh.json b/backend/i18n/frontend_zh.json index 1c366bd82..260f8f667 100644 --- a/backend/i18n/frontend_zh.json +++ b/backend/i18n/frontend_zh.json @@ -764,6 +764,8 @@ "schemas.fieldTypes.components.description": "将其他Schemas作为数组嵌入到此内容中。", "schemas.fieldTypes.dateTime.defaultMode": "默认模式", "schemas.fieldTypes.dateTime.description": "活动日期,开放时间。", + "schemas.fieldTypes.dateTime.format": "Pattern", + "schemas.fieldTypes.dateTime.formatHint": "The pattern when shown in the UI, see: https://date-fns.org/v2.22.1/docs/format", "schemas.fieldTypes.dateTime.rangeMax": "最大值", "schemas.fieldTypes.dateTime.rangeMin": "最小值", "schemas.fieldTypes.geolocation.description": "坐标:纬度和经度。", diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json index 8a78b7cc6..359942ff1 100644 --- a/backend/i18n/source/frontend_en.json +++ b/backend/i18n/source/frontend_en.json @@ -764,6 +764,8 @@ "schemas.fieldTypes.components.description": "Embed other schemas to this content as array.", "schemas.fieldTypes.dateTime.defaultMode": "Default Mode", "schemas.fieldTypes.dateTime.description": "Events date, opening hours.", + "schemas.fieldTypes.dateTime.format": "Pattern", + "schemas.fieldTypes.dateTime.formatHint": "The pattern when shown in the UI, see: https://date-fns.org/v2.22.1/docs/format", "schemas.fieldTypes.dateTime.rangeMax": "Max Value", "schemas.fieldTypes.dateTime.rangeMin": "Min Value", "schemas.fieldTypes.geolocation.description": "Coordinates: latitude and longitude.", diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/DateTimeFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/DateTimeFieldProperties.cs index e9dccf8ca..06abc3f27 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/DateTimeFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/DateTimeFieldProperties.cs @@ -19,6 +19,8 @@ namespace Squidex.Domain.Apps.Core.Schemas public Instant? MinValue { get; init; } + public string? Format { get; set; } + public DateTimeCalculatedDefaultValue? CalculatedDefaultValue { get; init; } public DateTimeFieldEditor Editor { get; init; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/DateTimeFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/DateTimeFieldPropertiesDto.cs index 582befc74..d44e2301b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/DateTimeFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/DateTimeFieldPropertiesDto.cs @@ -33,6 +33,11 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// public Instant? MinValue { get; set; } + /// + /// The format pattern when displayed in the UI. + /// + public string? Format { get; set; } + /// /// The editor that is used to manage this field. /// diff --git a/frontend/app/features/schemas/pages/schema/fields/types/date-time-ui.component.html b/frontend/app/features/schemas/pages/schema/fields/types/date-time-ui.component.html index d403ed259..1cfb72510 100644 --- a/frontend/app/features/schemas/pages/schema/fields/types/date-time-ui.component.html +++ b/frontend/app/features/schemas/pages/schema/fields/types/date-time-ui.component.html @@ -1,6 +1,6 @@
- +
@@ -10,6 +10,17 @@
+
+ + +
+ + + + + +
+
diff --git a/frontend/app/features/schemas/pages/schema/fields/types/tags-ui.component.html b/frontend/app/features/schemas/pages/schema/fields/types/tags-ui.component.html index 95b99f1fa..1cbdf43f7 100644 --- a/frontend/app/features/schemas/pages/schema/fields/types/tags-ui.component.html +++ b/frontend/app/features/schemas/pages/schema/fields/types/tags-ui.component.html @@ -1,6 +1,6 @@
- +
diff --git a/frontend/app/framework/angular/forms/editors/date-time-editor.component.html b/frontend/app/framework/angular/forms/editors/date-time-editor.component.html index f94f2ede9..53dc227e3 100644 --- a/frontend/app/framework/angular/forms/editors/date-time-editor.component.html +++ b/frontend/app/framework/angular/forms/editors/date-time-editor.component.html @@ -10,7 +10,9 @@
- diff --git a/frontend/app/shared/services/schemas.types.ts b/frontend/app/shared/services/schemas.types.ts index c1e3d5cfb..0c72ac145 100644 --- a/frontend/app/shared/services/schemas.types.ts +++ b/frontend/app/shared/services/schemas.types.ts @@ -293,6 +293,7 @@ export class DateTimeFieldPropertiesDto extends FieldPropertiesDto { public readonly calculatedDefaultValue?: string; public readonly defaultValue?: string; public readonly defaultValues?: DefaultValue; + public readonly format?: string; public readonly editor: DateTimeFieldEditor = 'DateTime'; public readonly maxValue?: string; public readonly minValue?: string; diff --git a/frontend/app/shared/state/contents.forms.visitors.ts b/frontend/app/shared/state/contents.forms.visitors.ts index 6c56459c6..025d6271d 100644 --- a/frontend/app/shared/state/contents.forms.visitors.ts +++ b/frontend/app/shared/state/contents.forms.visitors.ts @@ -136,9 +136,9 @@ export class FieldFormatter implements FieldPropertiesVisitor { const parsed = DateTime.parseISO(this.value); if (properties.editor === 'Date') { - return parsed.toStringFormatUTC('P'); + return parsed.toStringFormatUTC(properties.format ?? 'P'); } else { - return parsed.toStringFormat('Ppp'); + return parsed.toStringFormat(properties.format ?? 'Ppp'); } } catch (ex) { return this.value; diff --git a/frontend/app/shared/state/schemas.forms.ts b/frontend/app/shared/state/schemas.forms.ts index 62bfc3f4b..d0ee7b33a 100644 --- a/frontend/app/shared/state/schemas.forms.ts +++ b/frontend/app/shared/state/schemas.forms.ts @@ -300,6 +300,7 @@ export class EditFieldFormVisitor implements FieldPropertiesVisitor { this.config['calculatedDefaultValue'] = undefined; this.config['defaultValue'] = undefined; this.config['defaultValues'] = undefined; + this.config['format'] = undefined; this.config['maxValue'] = [undefined, ValidatorsEx.validDateTime()]; this.config['minValue'] = [undefined, ValidatorsEx.validDateTime()]; } diff --git a/frontend/app/theme/_forms.scss b/frontend/app/theme/_forms.scss index f1f19545f..155e6c08d 100644 --- a/frontend/app/theme/_forms.scss +++ b/frontend/app/theme/_forms.scss @@ -207,6 +207,12 @@ } } +.form-text { + a { + white-space: nowrap; + } +} + .col-form-label { font-size: 90%; }