# encoding: ascii
# api: powershell
# title: [datetime].Week
# description: This bit of code adds a Week ScriptProperty to datetime objects. The property returns the week of the year based on the current cultural settings.
# version: 0.1
# type: script
# author: Dale Thompson
# license: CC0
# x-poshcode-id: 6500
# x-archived: 2016-09-03T23:44:52
# x-published: 2016-09-01T15:59:00
#
#
Update-TypeData -Force -TypeName DateTime -MemberType ScriptProperty -MemberName Week -Value {
[System.Globalization.CultureInfo]$Culture = [System.Globalization.CultureInfo]::CurrentCulture
return $Culture.Calendar.GetWeekOfYear($this, $Culture.DateTimeFormat.CalendarWeekRule, $Culture.DateTimeFormat.FirstDayOfWeek)
}