--- /dev/null
+USING: calendar tools.cal.private tools.test ;
+IN: tools.cal.tests
+
+{
+ " October 2010 "
+} [
+ 2010 10 10 <date> month-header
+] unit-test
+
+{
+ " 2010 "
+} [
+ 2010 10 10 <date> year-header
+] unit-test
! Copyright (C) 2016 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors calendar combinators command-line formatting
-grouping io kernel math.parser math.ranges namespaces sequences
-sequences.extras strings.tables ;
-
+USING: accessors calendar combinators command-line
+formatting grouping io kernel math.parser math.ranges namespaces
+sequences sequences.extras strings.tables ;
IN: tools.cal
<PRIVATE
42 " " pad-tail ;
: month-header ( timestamp -- str )
- [ month-name ] [ year>> ] bi "%s %s" sprintf
+ "%B %Y" strftime
20 CHAR: \s pad-center ;
: year-header ( timestamp -- str )
- year>> "%s" sprintf 64 CHAR: \s pad-center ;
+ "%Y" strftime 64 CHAR: \s pad-center ;
: month-rows ( timestamp -- rows )
days 7 group day-abbreviations2 prefix format-table ;