You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make it available from main converter script and replace with this as it also checks for current valid ISO format:
functionConvert-ToISO8601Duration {
param (
[string]$timeValue
)
# Check if the input is already in a valid ISO 8601if ($timeValue-match'^P(\d+D)?(T(\d+H)?(\d+M)?)?$') {
return$timeValue# Return it as-is if it's already in ISO 8601 format
}
if ($timeValue-match'(\d+)([HMDhmd])') {
$value=$matches[1]
$unit=$matches[2].ToUpper()
switch ($unit) {
'H' { return"PT${value}H" }
'M' { return"PT${value}M" }
'D' { return"P${value}D" }
default { return$timeValue } # In case of unrecognized format, return input as-is
}
}
else {
return$timeValue# return it unchanged if not meeting criterias
}
}
The text was updated successfully, but these errors were encountered:
Make it available from main converter script and replace with this as it also checks for current valid ISO format:
The text was updated successfully, but these errors were encountered: