<commit_before>#Requires -Version 6.0

[CmdletBinding()]
param(
    [Parameter(Mandatory=$true)]
    [string]$PackageName,
    [string]$ServiceDirectory,
    [string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
    [string]$BuildType # For Java
)

. ${PSScriptRoot}\common.ps1

function Get-ReleaseDay($baseDate)
{
    # Find first friday
    while ($baseDate.DayOfWeek -ne 5)
    {
        $baseDate = $baseDate.AddDays(1)
    }
    
    # Go to Tuesday
    $baseDate = $baseDate.AddDays(4)

    return $baseDate;
}

$ErrorPreference = 'Stop'

$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $serviceDirectory

Write-Host "Source directory [ $serviceDirectory ]"

if (!$ReleaseDate)
{
    $currentDate = Get-Date
    $thisMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1));
    $nextMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1).AddMonths(1));

    if ($thisMonthReleaseDate -ge $currentDate)
    {
        # On track for this month release
        $ParsedReleaseDate = $thisMonthReleaseDate
    }
    elseif ($currentDate.Day -lt 15)
    {
        # Catching up to this month release
        $ParsedReleaseDate = $currentDate
    }
    else 
    {
        # Next month release
        $ParsedReleaseDate = $nextMonthReleaseDate
    }
}
else
{
    $ParsedReleaseDate = ([datetime]$ReleaseDate, 'MM/dd/yyyy', [Globalization.CultureInfo]::InvariantCulture)<commit_msg>Fix DateTime bug (#16456)<commit_after>#Requires -Version 6.0

[CmdletBinding()]
param(
    [Parameter(Mandatory=$true)]
    [string]$PackageName,
    [string]$ServiceDirectory,
    [string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
    [string]$BuildType # For Java
)

. ${PSScriptRoot}\common.ps1

function Get-ReleaseDay($baseDate)
{
    # Find first friday
    while ($baseDate.DayOfWeek -ne 5)
    {
        $baseDate = $baseDate.AddDays(1)
    }
    
    # Go to Tuesday
    $baseDate = $baseDate.AddDays(4)

    return $baseDate;
}

$ErrorPreference = 'Stop'

$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $serviceDirectory

Write-Host "Source directory [ $serviceDirectory ]"

if (!$ReleaseDate)
{
    $currentDate = Get-Date
    $thisMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1));
    $nextMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1).AddMonths(1));

    if ($thisMonthReleaseDate -ge $currentDate)
    {
        # On track for this month release
        $ParsedReleaseDate = $thisMonthReleaseDate
    }
    elseif ($currentDate.Day -lt 15)
    {
        # Catching up to this month release
        $ParsedReleaseDate = $currentDate
    }
    else 
    {
        # Next month release
        $ParsedReleaseDate = $nextMonthReleaseDate
    }
}
else
{
    $ParsedReleaseDate = [datetime]$ReleaseDate
{'fraction_non_alphanumeric': 0.1180280676502339, 'fraction_numerical': 0.009715725080964376, 'mean_word_length': 3.2057488653555217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4213589', 'n_tokens_mistral': 909, 'n_tokens_neox': 874, 'n_words': 192}