Skip to content

Commit 9ad68fb

Browse files
committed
Small adjustments
1 parent b0b942a commit 9ad68fb

File tree

4 files changed

+94
-94
lines changed

4 files changed

+94
-94
lines changed

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/date-only.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Without Models Builder:
5050

5151
## Add values programmatically
5252

53-
When working with this property editor programmatically, understand that it stores values as a JSON object. The object contains the date (as an ISO 8601 string) with time set to midnight and UTC offset.
53+
This property editor stores values as a JSON object. The object contains the date as an ISO 8601 string with midnight time and UTC offset.
5454

5555
### Storage format
5656

@@ -61,7 +61,7 @@ The property editor stores values in this JSON format:
6161
}
6262
```
6363

64-
The property editor handles date-only values. The time is automatically set to 00:00:00 and offset to +00:00 for storage consistency. These time components are not used in the Date Only context.
64+
The property editor handles date-only values. Time is set to 00:00:00 and offset to +00:00 for storage consistency. These time components are ignored in Date Only context.
6565

6666
1. Create a C# model that matches the JSON schema.
6767

@@ -80,19 +80,19 @@ The property editor handles date-only values. The time is automatically set to 0
8080
}
8181
```
8282
2. Convert your existing date value to `DateTimeOffset` for storage.
83-
83+
8484
If you have a `DateOnly`:
85-
```csharp
86-
DateOnly dateOnly = DateOnly.FromDateTime(DateTime.Today); // Your existing DateOnly value
87-
DateTimeOffset dateTimeOffset = dateOnly.ToDateTime(TimeOnly.MinValue);
88-
```
85+
```csharp
86+
DateOnly dateOnly = DateOnly.FromDateTime(DateTime.Today); // Your existing DateOnly value
87+
DateTimeOffset dateTimeOffset = dateOnly.ToDateTime(TimeOnly.MinValue);
88+
```
8989

9090
If you have a `DateTime`:
91-
```csharp
92-
DateTime dateTime = DateTime.Today; // Your existing DateTime value
93-
DateOnly dateOnly = DateOnly.FromDateTime(dateTime);
94-
DateTimeOffset dateTimeOffset = dateOnly.ToDateTime(TimeOnly.MinValue);
95-
```
91+
```csharp
92+
DateTime dateTime = DateTime.Today; // Your existing DateTime value
93+
DateOnly dateOnly = DateOnly.FromDateTime(dateTime);
94+
DateTimeOffset dateTimeOffset = dateOnly.ToDateTime(TimeOnly.MinValue);
95+
```
9696

9797
3. Create an instance of the class with the `DateTimeOffset` value.
9898
```csharp
@@ -103,17 +103,17 @@ The property editor handles date-only values. The time is automatically set to 0
103103
```
104104

105105
4. Inject the `IJsonSerializer` and use it to serialize the object.
106-
```csharp
107-
string jsonValue = _jsonSerializer.Serialize(value);
108-
```
109-
106+
```csharp
107+
string jsonValue = _jsonSerializer.Serialize(value);
108+
```
109+
110110
5. Inject the `IContentService` to retrieve and update the value of a property of the desired content item.
111-
```csharp
112-
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
111+
```csharp
112+
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
113113

114-
// Set the value of the property with alias 'eventDate'.
115-
content.SetValue("eventDate", jsonValue);
114+
// Set the value of the property with alias 'eventDate'.
115+
content.SetValue("eventDate", jsonValue);
116116

117-
// Save the change
118-
_contentService.Save(content);
119-
```
117+
// Save the change
118+
_contentService.Save(content);
119+
```

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/date-time-unspecified.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`Returns: DateTime?`
88

9-
The Date Time (Unspecified) property editor provides a comprehensive interface for selecting dates and times without time zone information.
9+
The Date Time (Unspecified) property editor provides a comprehensive interface for selecting dates and times. It excludes time zone information.
1010

1111
## Key Features
1212

@@ -40,7 +40,7 @@ Use this when you need more precise timing.
4040

4141
### Adding or editing a value
4242

43-
You will be presented with a date and time input. Unlike the time zone version, this editor focuses only on the date and time components.
43+
You will be presented with a date and time input. This editor focuses only on the date and time components, unlike the time zone version.
4444

4545
![Date Time Unspecified property editor interface](../built-in-umbraco-property-editors/images/date-time-unspecified-editor.png)
4646

@@ -62,7 +62,7 @@ Without Models Builder:
6262

6363
## Add values programmatically
6464

65-
When working with this property editor programmatically, understand that it stores values as a JSON object. The object contains the date (as an ISO 8601 string).
65+
This property editor stores values as a JSON object. The object contains the date as an ISO 8601 string.
6666

6767
### Storage format
6868

@@ -73,7 +73,7 @@ The property editor stores values in this JSON format:
7373
}
7474
```
7575

76-
The property editor handles unspecified date times with no time zone information. The value is stored with offset +00:00 for consistency. The offset is not used unless you replace the property editor with the Date Time (with time zone) version.
76+
The property editor handles unspecified date times with no time zone information. The value is stored with offset +00:00 for consistency. The offset is ignored unless you replace this editor with the Date Time (with time zone) version.
7777

7878
1. Create a C# model that matches the JSON schema.
7979

@@ -93,31 +93,31 @@ The property editor handles unspecified date times with no time zone information
9393
```
9494

9595
2. Convert your existing DateTime value to `DateTimeOffset` for storage.
96-
```csharp
97-
DateTime dateTime = DateTime.Now; // Your existing DateTime value
98-
DateTimeOffset dateTimeOffset = dateTime; // Explicit conversion
99-
```
96+
```csharp
97+
DateTime dateTime = DateTime.Now; // Your existing DateTime value
98+
DateTimeOffset dateTimeOffset = dateTime; // Explicit conversion
99+
```
100100

101101
3. Create an instance of the class with the `DateTimeOffset` value.
102-
```csharp
103-
var value = new DateTimeUnspecified
104-
{
105-
Date = dateTimeOffset
106-
};
107-
```
108-
109-
4. Inject the `IJsonSerializer` and use it to serialize the object.
110-
```csharp
111-
string jsonValue = _jsonSerializer.Serialize(value);
112-
```
102+
```csharp
103+
var value = new DateTimeUnspecified
104+
{
105+
Date = dateTimeOffset
106+
};
107+
```
108+
109+
4. Inject the `IJsonSerializer` and use it to serialize the object.
110+
```csharp
111+
string jsonValue = _jsonSerializer.Serialize(value);
112+
```
113113

114114
5. Inject the `IContentService` to retrieve and update the value of a property of the desired content item.
115-
```csharp
116-
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
115+
```csharp
116+
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
117117

118-
// Set the value of the property with alias 'eventDateTime'.
119-
content.SetValue("eventDateTime", jsonValue);
118+
// Set the value of the property with alias 'eventDateTime'.
119+
content.SetValue("eventDateTime", jsonValue);
120120

121-
// Save the change
122-
_contentService.Save(content);
123-
```
121+
// Save the change
122+
_contentService.Save(content);
123+
```

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/date-time-with-time-zone.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`Returns: DateTimeOffset?`
88

9-
The Date Time with Time Zone property editor provides a comprehensive interface for selecting dates, times, and time zones. It stores values as ISO 8601 date/time strings with time zone information. This makes it ideal for applications that need to handle dates across different time zones accurately.
9+
The Date Time with Time Zone property editor provides a comprehensive interface for selecting dates, times, and time zones. It stores values as ISO 8601 date/time strings with time zone information. This makes it ideal for applications that need accurate date handling across different time zones.
1010

1111
## Key Features
1212

@@ -44,7 +44,7 @@ Use this when you need more precise timing.
4444
- **Local** - Displays only the local time zone of the user's browser/computer.
4545
Useful for simplifying the UI when time entries should always be based on the user’s local context.
4646
- **Custom** - Allows you to define a list of time zones.
47-
When you select this option, a dropdown appears. You can search and select from the full IANA time zone list. Add multiple zones to restrict user selection to only those you specify.
47+
When you select this option, a dropdown appears. You can search and select from the full IANA time zone list. Add multiple zones to restrict user selection to only the zones you specify.
4848
- Example:
4949
Selecting the following time zones:
5050
- `Coordinated Universal Time (UTC)`
@@ -60,11 +60,11 @@ Daylight saving time (DST) is also taken into account.
6060

6161
### Adding or editing a value
6262

63-
You will be presented with a date, time and time zone input. The time zone input allows for typing, which filters the list of presented time zones.
63+
You will be presented with date, time and time zone inputs. The time zone input allows typing, which filters the list of presented time zones.
6464

6565
![Date Time with Time Zone property editor showing time zone dropdown with filtering functionality as user types](../built-in-umbraco-property-editors/images/date-time-with-time-zone-filtering.png)
6666

67-
If your browser time zone is in the list, and no date has been stored yet, the browser time zone will be pre-selected by default.
67+
If your browser time zone is in the list and no date has been stored yet, the browser time zone will be pre-selected by default.
6868

6969
If only one time zone is available, you will see a simple label with the time zone name instead.
7070

@@ -106,7 +106,7 @@ DateTime? utcDateTime = Model.EventDateTime?.UtcDateTime;
106106

107107
## Add values programmatically
108108

109-
When working with this property editor programmatically, it's important to understand that it stores values as a JSON object containing both the date (as an ISO 8601 string) and the selected time zone (as an IANA identifier).
109+
This property editor stores values as a JSON object. The object contains both the date (as an ISO 8601 string) and the selected time zone (as an IANA identifier).
110110

111111
### Storage format
112112

@@ -142,26 +142,26 @@ The property editor stores values in this JSON format:
142142
```
143143

144144
2. Create an instance of the created class with the desired values.
145-
```csharp
146-
var value = new DateTimeWithTimeZone
147-
{
148-
Date = DateTimeOffset.Now, // The date and time value to store.
149-
TimeZone = "Europe/Copenhagen" // The time zone to pre-select in the editor.
150-
};
151-
```
145+
```csharp
146+
var value = new DateTimeWithTimeZone
147+
{
148+
Date = DateTimeOffset.Now, // The date and time value to store.
149+
TimeZone = "Europe/Copenhagen" // The time zone to pre-select in the editor.
150+
};
151+
```
152152

153153
3. Inject the `IJsonSerializer` and use it to serialize the object.
154-
```csharp
155-
var jsonValue = _jsonSerializer.Serialize(value);
156-
```
154+
```csharp
155+
var jsonValue = _jsonSerializer.Serialize(value);
156+
```
157157

158158
4. Inject the `IContentService` to retrieve and update the value of a property of the desired content item.
159-
```csharp
160-
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
159+
```csharp
160+
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
161161

162-
// Set the value of the property with alias 'eventDateTime'.
163-
content.SetValue("eventDateTime", jsonValue);
162+
// Set the value of the property with alias 'eventDateTime'.
163+
content.SetValue("eventDateTime", jsonValue);
164164

165-
// Save the change
166-
_contentService.Save(content);
167-
```
165+
// Save the change
166+
_contentService.Save(content);
167+
```

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/time-only.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`Returns: TimeOnly?`
88

9-
The Time Only property editor provides a simple interface for selecting times without date or time zone information. It focuses purely on time selection and returns strongly-typed `TimeOnly` values.
9+
The Time Only property editor provides a simple interface for selecting times. It excludes date or time zone information and returns strongly-typed `TimeOnly` values.
1010

1111
## Key Features
1212

@@ -64,7 +64,7 @@ Without Models Builder:
6464

6565
## Add values programmatically
6666

67-
When working with this property editor programmatically, understand that it stores values as a JSON object. The object contains the time (as an ISO 8601 string) with a default date and UTC offset.
67+
This property editor stores values as a JSON object. The object contains the time as an ISO 8601 string with a default date and UTC offset.
6868

6969
### Storage format
7070

@@ -75,7 +75,7 @@ The property editor stores values in this JSON format:
7575
}
7676
```
7777

78-
The property editor handles time-only values. The date is automatically set to a default value (0001-01-01) and offset to +00:00 for storage consistency. The date component is not used in the Time Only context.
78+
The property editor handles time-only values. Date is set to a default value (0001-01-01) and offset to +00:00 for storage consistency. The date component is ignored in Time Only context.
7979

8080
1. Create a C# model that matches the JSON schema.
8181

@@ -95,19 +95,19 @@ The property editor handles time-only values. The date is automatically set to a
9595
```
9696

9797
2. Convert your existing time value to `DateTimeOffset` for storage.
98-
98+
9999
If you have a `TimeOnly`:
100-
```csharp
101-
TimeOnly timeOnly = TimeOnly.FromDateTime(DateTime.Now); // Your existing TimeOnly value
102-
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateOnly.MinValue, timeOnly, TimeSpan.Zero);
103-
```
100+
```csharp
101+
TimeOnly timeOnly = TimeOnly.FromDateTime(DateTime.Now); // Your existing TimeOnly value
102+
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateOnly.MinValue, timeOnly, TimeSpan.Zero);
103+
```
104104

105105
If you have a `DateTime`:
106-
```csharp
107-
DateTime dateTime = DateTime.Now; // Your existing DateTime value
108-
TimeOnly timeOnly = TimeOnly.FromDateTime(dateTime);
109-
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateOnly.MinValue, timeOnly, TimeSpan.Zero);
110-
```
106+
```csharp
107+
DateTime dateTime = DateTime.Now; // Your existing DateTime value
108+
TimeOnly timeOnly = TimeOnly.FromDateTime(dateTime);
109+
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateOnly.MinValue, timeOnly, TimeSpan.Zero);
110+
```
111111

112112
3. Create an instance of the class with the `DateTimeOffset` value.
113113
```csharp
@@ -118,17 +118,17 @@ The property editor handles time-only values. The date is automatically set to a
118118
```
119119

120120
4. Inject the `IJsonSerializer` and use it to serialize the object.
121-
```csharp
122-
string jsonValue = _jsonSerializer.Serialize(value);
123-
```
121+
```csharp
122+
string jsonValue = _jsonSerializer.Serialize(value);
123+
```
124124

125125
5. Inject the `IContentService` to retrieve and update the value of a property of the desired content item.
126-
```csharp
127-
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
126+
```csharp
127+
IContent content = _contentService.GetById(contentKey) ?? throw new Exception("Content not found");
128128

129-
// Set the value of the property with alias 'startHours'.
130-
content.SetValue("startHours", jsonValue);
129+
// Set the value of the property with alias 'startHours'.
130+
content.SetValue("startHours", jsonValue);
131131

132-
// Save the change
133-
_contentService.Save(content);
134-
```
132+
// Save the change
133+
_contentService.Save(content);
134+
```

0 commit comments

Comments
 (0)