Skip to content

Commit ec13a2f

Browse files
author
James Brundage
committed
feat: OpenGraph.get_HTML ( Fixes #8 )
Making [DateTime] universal and correctly formatted
1 parent a6f3169 commit ec13a2f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Types/OpenGraph/get_HTML.ps1

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
} else {
1212
foreach ($property in $this.PSObject.Properties) {
1313
if ($property.Name -match ':') {
14-
"<meta property='$($property.Name)' content='$([Web.HttpUtility]::HtmlAttributeEncode($property.Value))' />"
14+
$value = $property.Value
15+
if ($value -is [DateTime]) {
16+
$value = $value.ToUniversalTime().ToString('o')
17+
}
18+
"<meta property='$($property.Name)' content='$([Web.HttpUtility]::HtmlAttributeEncode($value))' />"
1519
}
1620
}
1721
}) -join [Environment]::Newline

0 commit comments

Comments
 (0)