Bug 234663 - calendar(1): Parsing of MonSecond in January 2019 is wrong
Summary: calendar(1): Parsing of MonSecond in January 2019 is wrong
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-01-06 14:21 UTC by Katsuyuki Miyoshi
Modified: 2019-01-09 15:49 UTC (History)
0 users

See Also:


Attachments
patch parsedaymonth() (507 bytes, patch)
2019-01-08 05:21 UTC, Katsuyuki Miyoshi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katsuyuki Miyoshi 2019-01-06 14:21:09 UTC
====================================
% grep Adults /usr/share/calendar/calendar.holiday
01/MonSecond    Adults Day in Japan
====================================

"Adults Day in Japan" is the second Monday in January.

====================================
% calendar -A 30 -t 1.1.2019 -f /usr/share/calendar/calendar.holiday|grep Adults
Jan  7* Adults Day in Japan
====================================

This is incorrect.

====================================
% cal
    January 2019
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
====================================

The correct result is

"Jan 14* Adults Day in Japan".

It is correct to try it with "01/TueSecond  Test Day"

====================================
% calendar -A 30 -t 1.1.2019 -f TestDayfile
Jan  8* Test Day
====================================

Only Monday is wrong. And on February Thursday is wrong.
It seems that the day before the first day of the month is being counted in the first week.

Thanks.
Comment 1 Katsuyuki Miyoshi 2019-01-08 05:21:18 UTC
Created attachment 200902 [details]
patch parsedaymonth()

This is a simple fix.
Comment 2 Katsuyuki Miyoshi 2019-01-08 05:35:41 UTC
(In reply to Katsuyuki Miyoshi from comment #1)
Sorry, this is usr.bin/calendar/parsedata.c.