Skip to content

Commit 436bbfc

Browse files
committed
Fix the API documentation
1 parent 8d5604b commit 436bbfc

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

ballerina/time_apis.bal

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public isolated function utcAddSeconds(Utc utc, Seconds seconds) returns Utc {
7676
return [secondsFromEpoch, lastSecondFraction];
7777
}
7878

79-
# Returns difference in seconds between `utc1` and `utc2`.
79+
# Returns difference in seconds between two UTC times.
8080
# This will be positive if `utc1` occurs after `utc2`
8181
# ```ballerina
8282
# time:Utc utc1 = time:utcNow();
@@ -85,7 +85,7 @@ public isolated function utcAddSeconds(Utc utc, Seconds seconds) returns Utc {
8585
# ```
8686
# + utc1 - 1st Utc time as a tuple `[int, decimal]`
8787
# + utc2 - 2nd Utc time as a tuple `[int, decimal]`
88-
# + return - The difference between `utc1` and `utc2` as `Seconds`
88+
# + return - The difference between `utc1` and `utc2` in seconds
8989
public isolated function utcDiffSeconds(Utc utc1, Utc utc2) returns Seconds {
9090
return externUtcDiffSeconds(utc1, utc2);
9191
}
@@ -106,8 +106,8 @@ public isolated function dateValidate(Date date) returns Error? {
106106
# time:Date date = {year: 1994, month: 11, day: 7};
107107
# time:DayOfWeek day = time:dayOfWeek(date);
108108
# ```
109-
# + date - Date value
110-
# + return - `time:DayOfWeek` if the `date` is valid or else panic
109+
# + date - The date for which the day of the week is to be calculated
110+
# + return - The `time:DayOfWeek` if the `date` is valid or else panic
111111
public isolated function dayOfWeek(Date date) returns DayOfWeek {
112112
DayOfWeek[] daysOfWeek = [SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY];
113113
return daysOfWeek[checkpanic externDayOfWeek(date)];
@@ -118,18 +118,18 @@ public isolated function dayOfWeek(Date date) returns DayOfWeek {
118118
# time:Utc utc = time:utcNow();
119119
# time:Civil civil = time:utcToCivil(utc);
120120
# ```
121-
# + utc - `time:Utc` timestamp
121+
# + utc - The `time:Utc` timestamp value to be converted
122122
# + return - The corresponding `time:Civil` value
123123
public isolated function utcToCivil(Utc utc) returns Civil {
124124
return externUtcToCivil(utc);
125125
}
126126

127-
# Converts a given `Civil` value to an `Utc` timestamp.
127+
# Converts a given `time:Civil` value to an `time:Utc` timestamp.
128128
# ```ballerina
129129
# time:Civil civil = time:utcToCivil(time:utcNow());
130130
# time:Utc utc = time:utcFromCivil(civil);
131131
# ```
132-
# + civilTime - `time:Civil` time
132+
# + civilTime - The `time:Civil` value to be converted
133133
# + return - The corresponding `time:Utc` value or an error if `civilTime.utcOffset` is missing
134134
public isolated function utcFromCivil(Civil civilTime) returns Utc|Error {
135135
ZoneOffset utcOffset;
@@ -156,7 +156,7 @@ public isolated function utcFromCivil(Civil civilTime) returns Utc|Error {
156156
# time:Civil|time:Error civil1 = time:civilFromString("2021-04-12T23:20:50.520+05:30[Asia/Colombo]");
157157
# time:Civil|time:Error civil2 = time:civilFromString("2007-12-03T10:15:30.00Z");
158158
# ```
159-
# + dateTimeString - RFC 3339 timestamp (e.g., `2007-12-03T10:15:30.00Z`) as a string
159+
# + dateTimeString - RFC 3339 timestamp (e.g., `2007-12-03T10:15:30.00Z`) as a string.
160160
# + return - The corresponding `time:Civil` value or an error if the given `dateTimeString` is invalid
161161
public isolated function civilFromString(string dateTimeString) returns Civil|Error {
162162
return check externCivilFromString(dateTimeString);
@@ -167,7 +167,7 @@ public isolated function civilFromString(string dateTimeString) returns Civil|Er
167167
# time:Civil civil = check time:civilFromString("2007-12-03T10:15:30.00Z");
168168
# string|time:Error civilString = time:civilToString(civil);
169169
# ```
170-
# + civil - `time:Civil` that needs to be converted
170+
# + civil - The `time:Civil` value to be converted
171171
# + return - The corresponding string value or an error if the specified `time:Civil` contains invalid parameters (e.g., `month` > 12)
172172
public isolated function civilToString(Civil civil) returns string|Error {
173173
ZoneOffset? utcOffset = civil?.utcOffset;
@@ -194,9 +194,9 @@ public isolated function civilToString(Civil civil) returns string|Error {
194194
# time:Utc utc = time:utcNow();
195195
# string emailFormattedString = time:utcToEmailString(utc);
196196
# ```
197-
# + utc - The UTC value to be formatted
197+
# + utc - The `time:UTC` value to be formatted
198198
# + zh - Type of the zone value to be added
199-
# + return - The corresponding formatted string
199+
# + return - The corresponding formatted string value
200200
public isolated function utcToEmailString(Utc utc, UtcZoneHandling zh = "0") returns string {
201201
return externUtcToEmailString(utc, zh);
202202
}
@@ -206,20 +206,20 @@ public isolated function utcToEmailString(Utc utc, UtcZoneHandling zh = "0") ret
206206
# time:Civil|time:Error emailDateTime = time:civilFromEmailString("Wed, 10 Mar 2021 19:51:55 -0820");
207207
# ```
208208
# + dateTimeString - RFC 5322 formatted (e.g `Wed, 10 Mar 2021 19:51:55 -0800 (PST)`) string to be converted
209-
# + return - The corresponding civil record or an error if the given string is incorrectly formatted.
209+
# + return - The corresponding `time:Civil` record or an error if the given string is incorrectly formatted.
210210
public isolated function civilFromEmailString(string dateTimeString) returns Civil|Error {
211211
return check externCivilFromEmailString(dateTimeString);
212212
}
213213

214-
# Converts a given Civil record to RFC 5322 format (e.g `Wed, 10 Mar 2021 19:51:55 -0800 (PST)`).
214+
# Converts a given `time:Civil` record to RFC 5322 format (e.g `Wed, 10 Mar 2021 19:51:55 -0800 (PST)`).
215215
# ```ballerina
216216
# time:Civil civil = check time:civilFromString("2021-04-12T23:20:50.520+05:30[Asia/Colombo]");
217217
# string|time:Error emailDateTime = time:civilToEmailString(civil, time:PREFER_ZONE_OFFSET);
218218
# ```
219-
# + civil - The civil record to be converted
219+
# + civil - The `time:Civil` record to be converted
220220
# + zoneHandling - Indicate how to handle the zone by specifying the preference whether to give preference to zone
221221
# offset or time abbreviation. Also, this can configure to use zone offset to the execution and use time abbreviation as a comment.
222-
# + return - RFC 5322 formatted (e.g `Wed, 10 Mar 2021 19:51:55 -0800 (PST)`) string or
222+
# + return - The RFC 5322 formatted (e.g `Wed, 10 Mar 2021 19:51:55 -0800 (PST)`) string or
223223
# an error if the specified `time:Civil` contains invalid parameters (e.g., `month` > 12)
224224
public isolated function civilToEmailString(Civil civil, HeaderZoneHandling zoneHandling) returns string|Error {
225225
int utcOffsetHours = 0;

ballerina/time_types.bal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ public type Zone readonly & object {
190190
# + return - The fixed zone offset or nil
191191
public isolated function fixedOffset() returns ZoneOffset?;
192192

193-
# Converts a given `Civil` value to an `Utc` timestamp based on the time zone value.
193+
# Converts a given `time:Civil` value to an `time:Utc` timestamp based on the time zone value.
194194
#
195-
# + civil - `Civil` time
196-
# + return - The corresponding `Utc` value or an error if `civil.timeAbbrev` is missing
195+
# + civil - The `time:Civil` value to be converted
196+
# + return - The corresponding `time:Utc` value or an error if `civil.timeAbbrev` is missing
197197
public isolated function utcFromCivil(Civil civil) returns Utc|Error;
198198

199-
# Converts a given `Utc` timestamp to a `Civil` value based on the time zone value.
199+
# Converts a given `time:Utc` timestamp to a `time:Civil` value based on the time zone value.
200200
#
201-
# + utc - `Utc` timestamp
202-
# + return - The corresponding `Civil` value
201+
# + utc - The `time:Utc` timestamp value to be converted
202+
# + return - The corresponding `time:Civil` value
203203
public isolated function utcToCivil(Utc utc) returns Civil;
204204
};
205205

@@ -228,7 +228,7 @@ public readonly class TimeZone {
228228

229229
# Converts a given `time:Civil` value to an `time:Utc` timestamp based on the time zone value.
230230
#
231-
# + civil - `time:Civil` time
231+
# + civil - The `time:Civil` value to be converted
232232
# + return - The corresponding `time:Utc` value or an error if `civil.timeAbbrev` is missing
233233
public isolated function utcFromCivil(Civil civil) returns Utc|Error {
234234
string? timeAbbrev = civil?.timeAbbrev;
@@ -243,7 +243,7 @@ public readonly class TimeZone {
243243

244244
# Converts a given `time:Utc` timestamp to a `time:Civil` value based on the time zone value.
245245
#
246-
# + utc - `time:Utc` timestamp
246+
# + utc - The `time:Utc` timestamp value to be converted
247247
# + return - The corresponding `time:Civil` value
248248
public isolated function utcToCivil(Utc utc) returns Civil {
249249
return externTimeZoneUtcToCivil(self, utc);
@@ -264,7 +264,7 @@ public isolated function loadSystemZone() returns Zone|Error {
264264
# time:Zone? zone = time:getZone("Asia/Colombo");
265265
# ```
266266
# + id - Time zone ID in the format of ("Continent/City")
267-
# + return - Corresponding ime zone object or null
267+
# + return - Corresponding time zone object or null
268268
public isolated function getZone(string id) returns Zone? {
269269
TimeZone|Error timeZone = new TimeZone(id);
270270
if timeZone is TimeZone {

0 commit comments

Comments
 (0)