changeset 30647:e9bfb92dab01

datevec.m: Emit warning if format specifiers are used with opposite case (bug #47627). * scripts/time/datevec.m (__date_vfmt2sfmt__): Emit warning if date or time format specifiers are used with opposite case.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 14 Jan 2022 18:27:06 +0100
parents 7677d53497c9
children c7a515aa767e
files scripts/time/datevec.m
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/time/datevec.m	Fri Jan 14 17:55:53 2022 +0100
+++ b/scripts/time/datevec.m	Fri Jan 14 18:27:06 2022 +0100
@@ -208,6 +208,13 @@
 
   original_f = f;   # Store for error messages.
 
+  if (any (ismember (f, "hsfYD")))
+    warning ("Octave:date-format-spec:wrong-case", ...
+             ["datevec: Format specifiers for dates should be lower case,", ...
+              " format specifiers for time should be upper case. ", ...
+              " Possible issue with 'm' (month) and 'M' (minutes)?"]);
+  endif
+
   ## Play safe with percent signs.
   f = strrep (f, "%", "%%");