Changelog
timeDate 4051.111
CRAN release: 2025-10-17
new class
"timeInterval"represents time intervals. Methods are defined for computing unions, intersections, complement and set difference of"timeInterval"objects, as well as checking whether dates and time intervals are contained in such objects. See?timeInterval,class ? timeInterval,?in_int. Not systematically tested yet.the prototype of class “timeDate” now sets admissible values for the slots. The previous defaults (e.g.,
character(0)for slots ‘format’ and ‘FinCenter’) were causing minor problems in rare cases.streamlined the initialisation method of “timeDate”. This changes slot ‘format’ in some inconsequential cases involving
Inf(e.g.,timeDate(.POSIXct(-Inf))@formatwas"%Y-%m-%d"but now is"%Y-%m-%d %H:%M:%S", which even seems more appropriate).the
"timeDate"methods fortruncandroundnow support also units “secs”, “months” and “years”. Previously only “days”, “hours”, “mins” were supported.The functions
timeLastDayInMonth,timeFirstDayInMonth,timeLastDayInQuarter,timeFirstDayInQuartertimeNthNdayInMonth,timeLastNdayInMonth,timeNdayOnOrAfterandtimeNdayOnOrBeforeare now documented to accepttimeDate,POSIXltand other time-date objects (and take into account their time zone). Previously, the first argument of these functions was documented to be a character vector but they were silently accepting time-date without checking the associated time zone. This could lead to wrong results in some cases.new function
pasteMat, likepastebut doesn’t convertNAs to the string"NA"and keepsNAs in the output. Also, argumentsepcan be a vector. Can be useful when creating date-times from individual pieces which may containNAs, see examples fortimeDate().fixed a bug in the internal function
.formatFinCenterNum(), which sometimes was causingtimeDate()to throw error when there wereNAdate-times.removed the deprecated
GBBankHoliday, useGBSpringBankHolidayinstead.removed the deprecated
GBMayDay, useGBEarlyMayBankHolidayinstead.removed the deprecated
GBMilleniumDay, usespecialHolidayGB(1999)instead.removed the deprecated
JPKeirouNOhi, use `JPKeirouNoHiinstead.
timeDate 4041.110
CRAN release: 2024-09-22
new
timeDatemethod for$for extraction of components of timeDate objects. For example, given a timeDate objecttd, numeric vectors containing the components ‘year’, ‘month’ and ‘sec’ can be obtained bytd$year,td$month, andtd$sec, respectively. In interactive sessions completion is supported, usually by hitting the ‘TAB’ key.new
timeDatemethods for the base R functionsquartersandweekdays(they return character vectors of names).-
new
timeDatemethod formonthsreturning a character vector. For now, a character vector will be returned only if argument ‘abbreviate’ is set explicitly (toTRUEorFALSE). If ‘abbreviate’ is missing, the numeric values are returned, see the deprecation note below.Deprecation Warning: a
timeDatemethod formonthshas existed for a long time but it was returning a numeric vector, which is inconsistent with the other methods for months in base R (they return names of months). Returning a numeric vector when ‘abbreviate’ is missing is a temporary compromise, to avoid breaking old code, but this should be considered deprecated. Usetd$monthto get the numbers. now
timeDate(character(0))returns a 0-length “timeDate” object. Previously it was returning anNA“timeDate” object of length 1 if argument ‘format’ was missing and a 0-length object otherwise.changed the “timeDate” method for
showto print something like ‘timeDate of length 0’ along with the FinCenter, which seems better than the previous output for this case.new function
InternationalWomensDay(suggested by Alexander Bartel with code), fixes R-forge issue #6855). It’s also included in the list returned bylistHolidays.
timeDate 4032.109
CRAN release: 2023-12-14
new function
earlyCloseNYSEgives datetimes of early closings of NYSE, including scheduled and unscheduled ones. The information is incomlete. This answers issue [#6757], see also the related issue [#1356] mentioned below in the news for a previous version.all functions returning public and eclessiastical holidays get new arguments
value,na_drop, and..., controlling the type of the return value and the handling of missing values. Argument...is for things like ‘format’ when applicable. Not all honour the new arguments though, see below.all functions returning public and eclessiastical holidays now honour the new argument
value.some holiday functions were amended or rewritten to honour the new argument
na_drop. These include the England holidays (‘GBxxx’), some Japan holidays (JPxxx), and a number of other functions (e.g., `CAFamilyDay). Contributions and/or information needed to have them do so is wellcome (e.g. dates when a holiday was introduced and/or moved).midnightStandard2()(and hencetimeDate()) was throwing a puzzling error when the input character vector contained one or moreNAs mixed with non-NA’s.whichFormat()was throwing error when the first element of the input vector wasNA. This could be considered a feature but that’s inconsistent sinceNAs at other positions were not causing trouble. Now fixed.the ‘character’ method for
timeDate()was passing only the first element of the input vector towhichFormat(). This was preventing it from inferring the format when argument ‘format’ was missing.new function
specialHolidayGBgives the special UK one-off holidays for the requested years.MilleniumDayis now deprecated, usespecialHolidayGB(1999).fixed omissions in
holidayLONDONand refactored it completely. It became easier to maintain and orders of magnitude faster.fixed a bug in an internal function which was throwing errors from
holidayLONDONfor some ranges including years before 1916.GBEarlyMayBankHoliday,GBSpringBankHolidayandGBSummerBankHolidaynow give dates according to historical rules, not simply according to current ones. See the remarks above about the new arguments of holiday functions.-
major overhaul and update of the Japan’s holidays. Previously fixed dates were returned for each holiday. Now moving holidays are calculated (e.g., second month of January) and some exceptions handled (like holidays moved due to the Olympics in 2020 and 2021). Historical changes are (partially) taken into account. Further corrections and historical amendments are welcome.
Thanks to Sylvie Lachaud for reporting the issues with Japan holiday functions, as well as providing current correct definitions and extensive list of links.
new function
JPMountainDaygives the relatively recently introduced Japan holiday ‘Mountain Day’.JPKeirouNoHireplacesJPKeirouNOhi. The latter is an aberration from all otherxxxNoHiJapanese holiday functions and a source of difficult to spot errors. The old one is now deprecated and will be removed in the future.modified the ‘timeDate’ method for
summaryto return an object from class “timeDate_summary” (rather than print directly) and created a print method for the latter.deprecated the
timeDatemethod forcut, see deprecation note for v4021.105 below.stopped exporting all but one (
.endpoints) functions starting with a ‘.’. They all seem for internal purposes and/or have similarly named functions with normal names.removed
.whichFormatand.midnightStandard, not officially deprecated but had been renamed towhichFormat()andmidnightStandard(), respectively, a long time ago.removed several internal functions that are no longer used anywhere in the package.
removed file ‘namespace-tags.R’ as it had not been updated recently, see revision r83578 or earlier if you need it.
timeDate 4022.108
CRAN release: 2023-01-07
added the 2023 UK Bank holiday for the coronation of King Charles III.
axis.timeDatewas not handling properly the case whenxwas missing, leading to errors from R-devel check (2023-01-07 r83578). Fix suggested by Uwe Lieges.refactored file NAMESPACE to facilitate maintenance (that revealed the two omissions listed below).
CAFamilyDay(Canada Family Day) was missing from the list returned bylistHolidays(). It was missing only from that list,holidayTSX()was including it when applicable.JPVernalEquinoxwas missing from the list returned bylistHolidays().the financial centers are now updated to reflect changes in time zones in recent years. The list returned by
listFinCenter()is synchronised with current time zone names. Previous names supported by timeDate are available as aliases.import selectively from ‘stats’ and ‘utils’.
timeDate 4021.107
CRAN release: 2022-12-08
London financial centre holidays - fixed and/or included non-standard holidays (e.g., Early May Bank holiday was moved in 2020 to VE day; Spring Bank holiday was moved in Queen’s Jubilee years; state funeral of the Queen). Millenium day now is included in the result of
holidayLONDON(1999). The London holidays should now be complete up to the time of writing this (1 Oct 2022).renamed
GBMayDaytoGBEarlyMayBankHolidayandGBBankHolidaytoGBSpringBankHoliday. The old names are somewhat ambiguous and strongly discouraged but still available.listHolidays()gives the new names.the generic
timeDate()gets argument ‘…’ to allow methods for it to have additional arguments (e.g., for DST gaps).the ‘character’ method for
timeDate()gets a new argumentdst_gapto control what to do with non-existent DST times at the requestedFinCenterwith options to add/subtract (“+”, “-”) the DST shift or set them toNA.timeDate()was not handling correctly some times just after the switch to/from DST. This was visible mostly for time zones away from GMT and GMT+1.-
In
timeSequence(), if any of the generated times would fall in DST gaps, they are moved by “+1 hour”, corresponding todst_gap = "+"intimeDate. This is consistent withseqfor other time objects. Currently there is no option to change this behaviour oftimeSequence.Previously
timeSequencewas moving DST gaps down by 1 hour (for by = ‘DSTday’ and similar). This was not consistent similar time functions in R and was actually due to a bug (or unfinished DST handling) intimeDate, see remarks fortimeDateabove. timeSequence()now throws error if argumentfromis in a DST gap. It seems desirable to have a default action for this case. Rolling the faulty time by an hour in the case of ‘DSTday’ may be suitable in most cases but for other values ofbyit might be totally wrong.updated the DST rules.
internally, refactored the way the DST rules are generated (not visible to users).
rulesFinCenter()now looks for a financial center starting from the namespace oftimeDate. Previously it was starting from the environment of the caller which could result in using an unrelated object or, iftimeDatewas loaded but not attached, not finding it.
timeDate 4021.106
CRAN release: 2022-09-30
- fix
whichFormat()to accommodate a change in R-devel after whichas.character(Sys.time())contains fractional seconds. (format(Sys.time())doesn’t; before this change in R-devel both were dropping the fractional seconds). (fixed by Martin Maechler, see timeDate rev 6286)
timeDate 4021.105
-
the list returned by
holidaysNYSE()was missing the special closing days of the New York stock exchange (NYSE). Now it should be complete (though there may be ommissions after 2011). This fixes issue #1356 reported by Corwin Joy. Thanks to him and Ian E for the insigthful discussion and useful links.See also below. Contributions for the other exchanges and corrections are welcome.
-
holidaysNYSE()gets a new argument,type, to select what type of the exchange’s closing days to return. The default is to return all days in the requested years when NYSE was closed for whatever reason. Usetype = "standard"andtype = specialto get the standard holidays and the special closings, respectively.Returning any closing day by default might be considered a breaking change. However, not returning all closing days was perceived as erroneous by users (eg issue #1356). In fact, the package itself calculates business days by dropping weekends and days returned by
holidayXXXX.Note that
holiday()returns the actual dates of the public holidays, while the corresponding days returned byholidayXXXXare the resulting non-weekend closing days, if any. holidayTSX()now correctly calculates Christmas and Boxing day closures when Christmas is on Monday. Fixes part (2) of issue #1288 reported by Stefan Wilhelm (part (1) was fixed in a previous release). The fix is really a patch for the specific issue, maybe the same should be done when Christmas is on Sunday, for example. Information/contribution on Canadian holidays is welcome.now
holiday()accepts also a function or a list of functions for argument ‘Holiday’.timeNthNdayInMonthcould return a value in the following month. Now fixed. This is bug #1463 reported with a fix by Manny C. Note that the bug was not present for dates in the first day of a month.timeLastNdayInMonthcould return a value in the following month, e.g. ‘1996-06-04’ for the last Tuesday in May 1996. Now fixed. The check of this function was prompted by the bug report for #1463 (see above) fortimeNthNdayInMonthbut the error was different.the
data.framemethods forkurtosis()andskewness()now set attributemethodas for the other methods and as documented.removed
.holidayList()which had been replaced bylistHolidays()a long time ago and was not exported in recent versions oftimeDate.updated documentation files.
Deprecation notes
- the
timeDatemethod forcuthas been discouraged in the sources for a long time with a recommendation to usewindowinstead (just replacecut(x, from = xx , to = yy)withwindow(x, start = xx, end = yy). Thecutmethod will be deprecated in the next release and later removed or replaced by a method that is consistent with the methods forcutin base R.
timeDate 4021.104
CRAN release: 2022-07-19
new maintainer: Georgi N. Boshnakov.
updated DESCRIPTION with links and moved all
Depends:toImports:.removed the line
LazyData: yesfrom DESCRIPTION to fix the NOTE on CRAN.added the new US holiday, Juneteenth National Independence Day. Fixes #6755 by Ian E (ene100).
holidayTSX()now includes the Labour Day. Fixes part (1) of issue #1288 reported by Stefan Wilhelm.created a first version of
_pkgdown.ymlfor more organised view of the large number of objects in the package. Unpack the tarball and runpkgdown::build_site()to build the site locally. Don’t know if this could work directly off the R-forge repository.