serokell / tzbot

Timezone bot for Slack
Mozilla Public License 2.0
7 stars 2 forks source link

[BUG] `TimeReference.trLocationRef` set to Nothing #101

Open dcastro opened 1 year ago

dcastro commented 1 year ago

Description

When a time reference has a timezone abbreviation, and is then followed by some text with another timezone abbreviation, TimeReference.trLocationRef is set to Nothing

To Reproduce

This works as expected:

$ parseTimeRefs "MSK 4 pm"
[ TimeReference
    { trText = "MSK 4 pm"
    , trTimeOfDay = 16:00:00
    , trDateRef = Nothing
    , trLocationRef = Just
        ( TimeZoneAbbreviationRef
            ( TimeZoneAbbreviationInfo
                { tzaiAbbreviation = "MSK"
                , tzaiOffsetMinutes = 180
                , tzaiFullName = "Moscow Time"
                }
            )
        )
    }
]

But if we add , GMT at the end, then TimeReference.trLocationRef is set to Nothing.

$ parseTimeRefs "MSK 4 pm, in GMT"
[ TimeReference
    { trText = "MSK 4 pm"
    , trTimeOfDay = 16:00:00
    , trDateRef = Nothing
    , trLocationRef = Nothing
    }
]

Expected behavior

Expected parseTimeRefs "MSK 4 pm, in GMT" to return the same result as parseTimeRefs "MSK 4 pm"

Environment