-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a standard string conversion for Civil type #6137
Labels
module/time
Reason/EngineeringMistake
The issue occurred due to a mistake made in the past.
Type/Bug
Comments
Tried the following sample with the latest Ballerina version(2201.10.0) and it is working as expected: public function main() returns error? {
time:Civil civil1 = {
year: 2022,
month: 1,
day: 29,
hour: 22,
minute: 48,
second: 0,
timeAbbrev: "Asia/Colombo",
utcOffset: {hours: 5, minutes: 30}
};
string civilString = check time:civilToString(civil1);
io:println("Civil Time string: ", civil1);
time:Civil civil2 = check time:civilFromString(civilString);
io:println("Civil Time 1: ", civil1);
io:println("Civil Time 2: ", civil2);
} $ bal run
Compiling source
tharmigan/zone_bbe:0.1.0
Running executable
Civil Time string: {"utcOffset":{"hours":5,"minutes":30},"timeAbbrev":"Asia/Colombo","year":2022,"month":1,"day":29,"hour":22,"minute":48,"second":0}
Civil Time 1: {"utcOffset":{"hours":5,"minutes":30},"timeAbbrev":"Asia/Colombo","year":2022,"month":1,"day":29,"hour":22,"minute":48,"second":0}
Civil Time 2: {"utcOffset":{"hours":5,"minutes":30},"timeAbbrev":"+05:30","dayOfWeek":6,"year":2022,"month":1,"day":29,"hour":22,"minute":48} This is fixed with #6986 |
TharmiganK
added
the
Reason/EngineeringMistake
The issue occurred due to a mistake made in the past.
label
Sep 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
module/time
Reason/EngineeringMistake
The issue occurred due to a mistake made in the past.
Type/Bug
Description:
Need to provide standards methods to convert a
time:Civil
value to astring
value and astring
value to atime:Civil
value withutcOffset
andtimeAbbrev
Steps to reproduce:
time:Civil
value with autcfOffset
and atimeAbbrev
time:Civil
value to astring
usingtime:civilToString
methodstring
value back to atime:Civil
value usingtime:civilFromString
methodAffected modules
The text was updated successfully, but these errors were encountered: