97jaz / gregor

Date and time library for Racket
45 stars 10 forks source link

parse-time does not suppoort `b` periods. #12

Open LeifAndersen opened 8 years ago

LeifAndersen commented 8 years ago

When I pass in a string that uses b, I get an error saying that b is a special character, and to use the string b instead. I however am not looking for a literal b, but the time that the b pattern gives. For example:

#lang racket
(require gregor)
(parse-time "4PM" "b")

Gives me the following error:

The character [b] is reserved in pattern syntax. Literal ASCII letters must be enclosed in single quotes. E.g., 'b'.
  context...:
   /Users/leif/rsrc/gregor/gregor-lib/gregor/private/exn.rkt:32:0: raise-pattern-error
   /Users/leif/rsrc/gregor/gregor-lib/gregor/private/pattern/lexer.rkt:27:0: pattern->ast-list
   /Users/leif/rsrc/gregor/gregor-lib/gregor/private/parse.rkt:65:0: parse-time
   /Users/leif/trash3.rkt: [running body]
97jaz commented 8 years ago

@LeifAndersen Thanks for bringing this to my attention. The 'b' pattern didn't exist when I implemented Gregor. (I think this was the current version then: http://www.unicode.org/reports/tr35/tr35-37/tr35-dates.html#Date_Format_Patterns). I'll need to add this as part of my revision work. Gregor is going to turn into a datetime library. I haven't had quite enough time to work on it recently, but I expect to fairly soon.

97jaz commented 8 years ago

This also means I need to be more careful when linking to CLDR from the documentation...

LeifAndersen commented 8 years ago

Ah, okay, thanks makes sense. Thank you.

LeifAndersen commented 8 years ago

As for linking to CLDR, why not just include a copy of the version you are using in the documentation itself?

97jaz commented 8 years ago

Yes, I absolutely should do that.