txt: ## earlier.md
  earlier
  
  Combined from primary sources listed below.
  
  # [In role Dateish](#___top "go to top of document")[§](#(role_Dateish)_method_earlier "direct link")
  
  See primary documentation
  [in context](/type/Dateish#method_earlier)
  for **method earlier**.
  
  ```raku
  multi method earlier(Dateish:D: *%unit)
  multi method earlier(Dateish:D: @pairs)
  ```
  
  Returns an object based on the current one, but with a date delta towards the past applied. Unless the given unit is `second` or `seconds`, the given value will be converted to an [`Int`](/type/Int). See [`.later`](/type/Dateish#method_later) for usage. It will generally be used through classes that implement this role, [`Date`](/type/Date) or [`DateTime`](/type/DateTime)
  
  ```raku
  my $d = Date.new('2015-02-27');
  say $d.earlier(month => 5).earlier(:2days);  # OUTPUT: «2014-09-25␤»
  my $d = DateTime.new(date => Date.new('2015-02-27'));
  say $d.earlier(month => 1).earlier(:2days);  # OUTPUT: «2015-01-25T00:00:00Z␤»
  ```
  
  If the resultant time has value `60` for seconds, yet no leap second actually exists for that time, seconds will be set to `59`:
  
  ```raku
  say DateTime.new('2008-12-31T23:59:60Z').earlier: :1day;
  # OUTPUT: «2008-12-30T23:59:59Z␤»
  ```
  
  Negative offsets are allowed, though [later](/routine/later) is more idiomatic for that.
  
  If you need to use more than one unit, you will need to build them into a [`List`](/type/List) of [`Pair`](/type/Pair)s to use the second form of the method:
  
  ```raku
  say Date.new('2021-03-31').earlier(  ( year => 3, month => 2, day => 8 ) ); # OUTPUT: «2018-01-23␤»
  
  ```
  
  This feature was introduced in release 2021.02 of the Rakudo compiler.
  