function [ y, m, d ] = day_borrow_common ( y, m, d )

%*****************************************************************************80
%
%% day_borrow_common() borrows days from months in a Common date.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 June 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, M, D, the YMD date.
%
%  Output:
%
%    integer Y, M, D, the YMD date after borrowing.
%
  while ( d <= 0 )

    m = m - 1;

    [ y, m ] = month_borrow_common ( y, m );

    days = month_length_common ( y, m );

    d = d + days;

  end

  return
end
