]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/tools/cal/cal.factor
tools.cal: using strftime + tests
[factor.git] / extra / tools / cal / cal.factor
index c0be27e16fa81de7ca7aefd269d5d6f9bf64336d..f887585baabbebf71fd91cd26e78cbe31c508c4f 100644 (file)
@@ -1,10 +1,8 @@
 ! 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
@@ -16,11 +14,11 @@ IN: tools.cal
     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 ;