@@ -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
8989public 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
111111public 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
123123public 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
134134public 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
161161public 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)
172172public 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
200200public 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.
210210public 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)
224224public isolated function civilToEmailString(Civil civil , HeaderZoneHandling zoneHandling ) returns string | Error {
225225 int utcOffsetHours = 0 ;
0 commit comments