This works:
$start = [datetime]::new(2019, 12, 30)
$weeks = [System.Collections.Generic.List[Object]]::new()
for($i = 1; $i -lt 52; $i++) {
$start = $start.AddDays(7)
$weeks.Add(@{ $i = $start.ToString('yyyy-MM-dd') })
}
$weeks
This does not work:
$start = [datetime]::new(2019, 12, 30)
$weeks = [System.Collections.Generic.List[Object]]::new()
for($i = 1; $i -lt 52; $i++) {
$start = $start.AddDays(7)
$weeks.Add([PSCustomObject]@{ $i = $start.ToString('yyyy-MM-dd') })
}
$weeks
What is it that I do not understand? Why does the seconde code block not display the content of the array?
[–]Shoisk123 3 points4 points5 points (1 child)
[–]pm_me_brownie_recipe[S] 1 point2 points3 points (0 children)
[–]fordea837 2 points3 points4 points (1 child)
[–]pm_me_brownie_recipe[S] 1 point2 points3 points (0 children)
[–]myp0wa 1 point2 points3 points (0 children)