[Contents] [TitleIndex] [WordIndex

1. SEP 2017: upgrading weekday()

1.1. Abstract

weekday() is prone to the bug #15200, and suffers from numerous limitations. For instance, its help page claims to accept dates as text like "17-Feb-2031", while it is not actually the case. We propose to fix the bug and extend weekday to accept new input syntaxes. A new LANG option is also introduced.

1.2. New dates syntaxes

All new syntaxes will accept the 'long' option.

1.2.1. weekday()

Without specifying any date number, the current date of today will be considered.

1.2.2. weekday(dateStrings)

dateStrings is a matrix of strings providing the dates. Four string formats are accepted and described here-below. In the matrix, all strings must have the same format:

1.2.3. weekday(Y, M, D)

1.2.4. weekday(YMD)

1.3. New LANG option

Currently, weekday always returns the short or long month names in the current session language, that may be distinct from en_US. From here, getting month names in en_US or any other supported language than the current one is complicated or even impossible, since gettext() is currently unable to translate an input other than from en_US. We propose to introduce a new LANG option to be specified at any place (before or after "long") 'after' the dates input(s). When it is used, month names are returned in the required language instead of in the session's language. LANG value is a single text word in the standard cc_CC format.

Despite this would not be back-compatible, we could propose making en_US the default instead of the current locale up to now.

1.4. Authors

2017 - Samuel GOUGEON


CategorySep


2022-09-08 09:27