 M: integer month-name check-month 1 - month-names nth ;
 M: timestamp month-name month>> 1 - month-names nth ;
 
-CONSTANT: month-abbreviations
+ERROR: not-a-month-abbreviation string ;
+
+CONSTANT: month-abbreviations-array
     {
         "Jan" "Feb" "Mar" "Apr" "May" "Jun"
         "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"
     }
 
-: month-abbreviation ( n -- string )
-    check-month 1 - month-abbreviations nth ;
+CONSTANT: month-abbreviations-hash
+    H{
+        { "Jan" 1 } { "Feb" 2 } { "Mar" 3 }
+        { "Apr" 4 } { "May" 5 } { "Jun" 6 }
+        { "Jul" 7 } { "Aug" 8 } { "Sep" 9 }
+        { "Oct" 10 } { "Nov" 11 } { "Dec" 12 }
+    }
+
+: n>month-abbreviation ( n -- string )
+    check-month 1 - month-abbreviations-array nth ;
+
+: month-abbreviation>n ( string -- n )
+    month-abbreviations-hash ?at
+    [ not-a-month-abbreviation ] unless ;
 
 CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
 

: day-abbreviation2 ( n -- string )
    day-abbreviations2 nth ; inline

CONSTANT: day-abbreviations3
    { "Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" }

: day-abbreviation3 ( n -- string )
    day-abbreviations3 nth ; inline

CONSTANT: average-month 30+5/12
CONSTANT: months-per-year 12

! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays classes.tuple combinators
combinators.short-circuit kernel locals math math.functions
math.order sequences summary system vocabs vocabs.loader
assocs ;
IN: calendar

HOOK: gmt-offset os ( -- hours minutes seconds )
