"That was call seventeen about the sales logger," said Jeff, "The dates are all mangled. Nothing’s getting logged. We need to escalate."

Tabitha, Jeff's supervisor, furrowed her brow. "Oh, we can’t escalate until we get eighteen complaints," she replied very matter-of-factly. Her sense of humor was so dry Jeff could never guess when she was kidding.

"I’ll get on it," Jeff replied.

The sales logger recorded every car sale made in the district. Contracted long ago, the logger had been usable but quirky. But now that it wasn’t working at all, Jeff needed to get it fixed.

Jeff opened the repo. The entire logging program operated on a 10,000-line script named greed-is-good.vbs. He sighed, resigned to working after 5 PM, and dug in.

At 7:15, he called Tabatha into his office. "I need a second opinion," he said. "Does this look like it was written by someone familiar with how a calendar works?"

Protected Sub PopulateDates()

    Dim year As Integer = DateTime.Today.Year
    Dim month As Integer = DateTime.Today.Month         
    Dim day As Integer = DateTime.Today.Day 
    Dim beginday As Integer 
    Dim beginmonth As Integer 
    Dim beginyear As Integer

    If day > 7 Then 
        beginday = DateTime.Today.Day - 7 
        beginmonth = month
    Else 
        beginday = 21 + day 
        beginmonth = month - 1
    End If

    If month = 1 And day < 7 Then
        beginyear = year - 1
    Else
        beginyear = year
    End If

    Dim testbeginday As String = beginmonth.ToString() + "/" + beginday.ToString() + "/" + beginyear.ToString() 
    Dim begindate As String = beginmonth.ToString() + "/" + beginday.ToString() + "/" + beginyear.ToString()
    
    txtBeginDate.Text = begindate 
    txtEndDate.Text = month.ToString() + "/" + day.ToString() + "/" + year.ToString()

End Sub

"Looks reasonable to me," Tabatha said, leaving Jeff at his desk.

Jeff replaced all instances of PopulateDates() with the built-in ToShortDateString(). After he left the office, Jeff still couldn’t figure out if Tabatha was trying to be funny.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!