我有两次,如何以人类可读的格式获取这两个可感知的日期时间对象的时差。我的可读格式是1 year 3 months 2 weeks 4 days 1 hour 2 minutes and 19 seconds
。
但是,如果时间差更短,它将给出类似2 minutes and 3 seconds
的可读格式(不会告诉我们0 years 0 months 0 weeks 0 days 0 hours 2 minutes and 52 seconds
)。或者,如果仅剩几秒钟,那就是15 seconds