icambron / twix.js

:hourglass::left_right_arrow: A date range plugin for moment.js
https://isaaccambron.com/twix.js/
MIT License
379 stars 54 forks source link

Bug while format with option {hideTime: true} #130

Open JackmanGo opened 1 year ago

JackmanGo commented 1 year ago

This method returns an empty string

    let str = mStart.twix(mEnd, {allDay: true}).format({hideTime: true})
    console.log("mStart:"+mStart)
    console.log("mEnd:"+mEnd)
    console.log("str:"+str)

In chrome console output:

start:2023-06-21
end:2023-06-20
str:

I expect the output to be "Jun 21-Jun 20," but why is it an empty string? Is this a bug? If the start date is today and the end date is yesterday, it results in an empty string while other time periods work fine

package.json:

 "moment": "2.22.2",
 "moment-timezone": "0.5.21",
 "twix": "1.2.1"

Thanks