purescript-contrib / purescript-formatters

Formatting and printing for numeric and date/time/interval values
Apache License 2.0
41 stars 30 forks source link

support two digits month #7

Closed zhangchiqing closed 7 years ago

zhangchiqing commented 7 years ago

Hi,

I'm not sure if I'm using a wrong method or miss anything, I expect the following code will print 2017-01-05 07:15:49 but I got: 2017-1-5 7:15:49

Can I get some help? Thanks

import Data.Formatter.DateTime as FDT
import Data.DateTime
import Data.DateTime.Instant
import Data.Either

main = do
  instant <- now
  let d = toDateTime instant
  case FDT.parseFormatString "YYYY-MM-DD HH:mm:ss" <#> flip FDT.format d of
    Left error -> log error
    Right f -> log f
garyb commented 7 years ago

Looks like a bug to me!