Mercurial > octave
comparison scripts/time/datevec.m @ 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 | beac32c0e9c7 |
children | c7a515aa767e |
comparison
equal
deleted
inserted
replaced
30646:7677d53497c9 | 30647:e9bfb92dab01 |
---|---|
205 endfunction | 205 endfunction |
206 | 206 |
207 function [f, rY, ry, fy, fm, fd, fh, fmi, fs] = __date_vfmt2sfmt__ (f) | 207 function [f, rY, ry, fy, fm, fd, fh, fmi, fs] = __date_vfmt2sfmt__ (f) |
208 | 208 |
209 original_f = f; # Store for error messages. | 209 original_f = f; # Store for error messages. |
210 | |
211 if (any (ismember (f, "hsfYD"))) | |
212 warning ("Octave:date-format-spec:wrong-case", ... | |
213 ["datevec: Format specifiers for dates should be lower case,", ... | |
214 " format specifiers for time should be upper case. ", ... | |
215 " Possible issue with 'm' (month) and 'M' (minutes)?"]); | |
216 endif | |
210 | 217 |
211 ## Play safe with percent signs. | 218 ## Play safe with percent signs. |
212 f = strrep (f, "%", "%%"); | 219 f = strrep (f, "%", "%%"); |
213 | 220 |
214 if (! isempty (strfind (f, "PM")) || ! isempty (strfind (f, "AM"))) | 221 if (! isempty (strfind (f, "PM")) || ! isempty (strfind (f, "AM"))) |