The obligation to give notice of a layoff depends upon whether the company is engaging in a mass or group layoff or a single layoff situation. If the WARN Act applies to the layoff in a group layoff situation (or more typically, where a plant or location completely closes down), that can require a 60-day notification to all effected employees.
State law may address this issue as well, but this typically falls into a question of an employer's comfort level with the employees and how they will react to the layoff. Assuming that it is one person effected by the layoff, would giving advance notice to that person result in possible sabotage? Would it cause the person to lack productivity until his/her last day of work? Does it create a security risk because that person has access to sensitive information?
In some case, an employer might consider some giving as a courtesy to the employee to allow him/her a jump on finding other employment (which could also cut down on the length of an unemployment claim).
Finally, an employer can offer a severance package which would typically be under the condition that the employee have at least 21 days to consider the offer (assuming it would be in compliance with the ADEA and the OWPBA). The last date of employment can be a future date or be in the past. In this sense, a severance package can be used to provide advance notice of a layoff.