javascript-time-ago 2.5.11 โ 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/README.md +410 -272
- package/bundle/javascript-time-ago.js +1 -1
- package/bundle/javascript-time-ago.js.map +1 -1
- package/bundle/javascript-time-ago.min.js +1 -1
- package/bundle/javascript-time-ago.min.js.map +1 -1
- package/commonjs/FullDateFormatter.js +72 -0
- package/commonjs/FullDateFormatter.js.map +1 -0
- package/commonjs/FullDateFormatter.test.js +26 -0
- package/commonjs/FullDateFormatter.test.js.map +1 -0
- package/commonjs/LocaleDataStore.js +2 -5
- package/commonjs/LocaleDataStore.js.map +1 -1
- package/commonjs/PropTypes.js +12 -12
- package/commonjs/PropTypes.js.map +1 -1
- package/commonjs/TimeAgo.js +300 -253
- package/commonjs/TimeAgo.js.map +1 -1
- package/commonjs/TimeAgo.test.js +214 -135
- package/commonjs/TimeAgo.test.js.map +1 -1
- package/commonjs/cache.js +7 -25
- package/commonjs/cache.js.map +1 -1
- package/commonjs/cache.test.js +1 -3
- package/commonjs/cache.test.js.map +1 -1
- package/commonjs/isStyleObject.js +9 -9
- package/commonjs/isStyleObject.js.map +1 -1
- package/commonjs/isStyleObject.test.js +1 -3
- package/commonjs/isStyleObject.test.js.map +1 -1
- package/commonjs/locale.js +6 -19
- package/commonjs/locale.js.map +1 -1
- package/commonjs/locale.test.js +2 -11
- package/commonjs/locale.test.js.map +1 -1
- package/commonjs/round.js +2 -5
- package/commonjs/round.js.map +1 -1
- package/commonjs/steps/approximate.js +1 -4
- package/commonjs/steps/approximate.js.map +1 -1
- package/commonjs/steps/approximate.test.js +1 -6
- package/commonjs/steps/approximate.test.js.map +1 -1
- package/commonjs/steps/getStep.js +36 -53
- package/commonjs/steps/getStep.js.map +1 -1
- package/commonjs/steps/getStep.test.js +7 -7
- package/commonjs/steps/getStep.test.js.map +1 -1
- package/commonjs/steps/getStepDenominator.js +2 -5
- package/commonjs/steps/getStepDenominator.js.map +1 -1
- package/commonjs/steps/getStepDenominator.test.js +1 -3
- package/commonjs/steps/getStepDenominator.test.js.map +1 -1
- package/commonjs/steps/getStepMinTime.js +31 -39
- package/commonjs/steps/getStepMinTime.js.map +1 -1
- package/commonjs/steps/getStepMinTime.test.js +1 -3
- package/commonjs/steps/getStepMinTime.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.js +27 -41
- package/commonjs/steps/getTimeToNextUpdate.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.test.js +29 -25
- package/commonjs/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.js +3 -12
- package/commonjs/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js +1 -7
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/commonjs/steps/helpers.js +1 -2
- package/commonjs/steps/helpers.js.map +1 -1
- package/commonjs/steps/helpers.test.js +0 -1
- package/commonjs/steps/helpers.test.js.map +1 -1
- package/commonjs/steps/index.js +1 -6
- package/commonjs/steps/index.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.js +6 -14
- package/commonjs/steps/renameLegacyProperties.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.test.js +1 -3
- package/commonjs/steps/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/steps/round.js +1 -2
- package/commonjs/steps/round.js.map +1 -1
- package/commonjs/steps/round.test.js +1 -7
- package/commonjs/steps/round.test.js.map +1 -1
- package/commonjs/steps/units.js +10 -21
- package/commonjs/steps/units.js.map +1 -1
- package/commonjs/style/approximate.js +2 -6
- package/commonjs/style/approximate.js.map +1 -1
- package/commonjs/style/approximateTime.js +2 -6
- package/commonjs/style/approximateTime.js.map +1 -1
- package/commonjs/style/approximateTime.test.js +116 -75
- package/commonjs/style/approximateTime.test.js.map +1 -1
- package/commonjs/style/getStyleByName.js +3 -29
- package/commonjs/style/getStyleByName.js.map +1 -1
- package/commonjs/style/mini.js +9 -6
- package/commonjs/style/mini.js.map +1 -1
- package/commonjs/style/mini.test.js +15 -25
- package/commonjs/style/mini.test.js.map +1 -1
- package/commonjs/style/miniMinute.js +8 -13
- package/commonjs/style/miniMinute.js.map +1 -1
- package/commonjs/style/miniMinute.test.js +11 -17
- package/commonjs/style/miniMinute.test.js.map +1 -1
- package/commonjs/style/miniMinuteNow.js +8 -13
- package/commonjs/style/miniMinuteNow.js.map +1 -1
- package/commonjs/style/miniMinuteNow.test.js +11 -17
- package/commonjs/style/miniMinuteNow.test.js.map +1 -1
- package/commonjs/style/miniNow.js +8 -13
- package/commonjs/style/miniNow.js.map +1 -1
- package/commonjs/style/miniNow.test.js +11 -17
- package/commonjs/style/miniNow.test.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.js +7 -13
- package/commonjs/style/renameLegacyProperties.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.test.js +1 -4
- package/commonjs/style/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/style/round.js +2 -6
- package/commonjs/style/round.js.map +1 -1
- package/commonjs/style/round.test.js +51 -67
- package/commonjs/style/round.test.js.map +1 -1
- package/commonjs/style/roundMinute.js +8 -13
- package/commonjs/style/roundMinute.js.map +1 -1
- package/commonjs/style/roundMinute.test.js +20 -27
- package/commonjs/style/roundMinute.test.js.map +1 -1
- package/commonjs/style/twitter.js +34 -39
- package/commonjs/style/twitter.js.map +1 -1
- package/commonjs/style/twitter.test.js +54 -57
- package/commonjs/style/twitter.test.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.js +10 -15
- package/commonjs/style/twitterFirstMinute.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.test.js +16 -23
- package/commonjs/style/twitterFirstMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinute.js +8 -13
- package/commonjs/style/twitterMinute.js.map +1 -1
- package/commonjs/style/twitterMinute.test.js +20 -25
- package/commonjs/style/twitterMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.js +8 -13
- package/commonjs/style/twitterMinuteNow.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.test.js +20 -25
- package/commonjs/style/twitterMinuteNow.test.js.map +1 -1
- package/commonjs/style/twitterNow.js +8 -13
- package/commonjs/style/twitterNow.js.map +1 -1
- package/commonjs/style/twitterNow.test.js +18 -24
- package/commonjs/style/twitterNow.test.js.map +1 -1
- package/full-date-formatter/index.cjs +4 -0
- package/full-date-formatter/index.cjs.js +9 -0
- package/full-date-formatter/index.d.ts +6 -0
- package/full-date-formatter/index.js +1 -0
- package/full-date-formatter/package.json +15 -0
- package/index.cjs +1 -1
- package/index.cjs.js +2 -2
- package/index.d.ts +14 -4
- package/index.js +3 -1
- package/load-all-locales/index.cjs +32 -0
- package/load-all-locales/index.cjs.js +32 -0
- package/load-all-locales/index.js +64 -0
- package/locale/ak/package.json +16 -0
- package/locale/ak.json +267 -0
- package/locale/ak.json.d.ts +4 -0
- package/locale/ak.json.js +267 -0
- package/locale/bal-Latn/package.json +16 -0
- package/locale/bal-Latn.json +240 -0
- package/locale/bal-Latn.json.d.ts +4 -0
- package/locale/bal-Latn.json.js +240 -0
- package/locale/be-tarask/package.json +16 -0
- package/locale/be-tarask.json +259 -0
- package/locale/be-tarask.json.d.ts +4 -0
- package/locale/be-tarask.json.js +259 -0
- package/locale/blo/package.json +16 -0
- package/locale/blo.json +159 -0
- package/locale/blo.json.d.ts +4 -0
- package/locale/blo.json.js +159 -0
- package/locale/bn.json +5 -2
- package/locale/bn.json.js +5 -2
- package/locale/bs.json +8 -2
- package/locale/bs.json.js +8 -2
- package/locale/ccp.json +2 -8
- package/locale/ccp.json.js +2 -8
- package/locale/csw/package.json +16 -0
- package/locale/csw.json +180 -0
- package/locale/csw.json.d.ts +4 -0
- package/locale/csw.json.js +180 -0
- package/locale/cy.json +6 -12
- package/locale/cy.json.js +6 -12
- package/locale/doi/package.json +16 -0
- package/locale/doi.json +159 -0
- package/locale/doi.json.d.ts +4 -0
- package/locale/doi.json.js +159 -0
- package/locale/en-AU.json +12 -12
- package/locale/en-AU.json.js +12 -12
- package/locale/en-CZ/package.json +16 -0
- package/locale/en-CZ.json +219 -0
- package/locale/en-CZ.json.d.ts +4 -0
- package/locale/en-CZ.json.js +219 -0
- package/locale/en-ES/package.json +16 -0
- package/locale/en-ES.json +219 -0
- package/locale/en-ES.json.d.ts +4 -0
- package/locale/en-ES.json.js +219 -0
- package/locale/en-FR/package.json +16 -0
- package/locale/en-FR.json +219 -0
- package/locale/en-FR.json.d.ts +4 -0
- package/locale/en-FR.json.js +219 -0
- package/locale/en-GS/package.json +16 -0
- package/locale/en-GS.json +219 -0
- package/locale/en-GS.json.d.ts +4 -0
- package/locale/en-GS.json.js +219 -0
- package/locale/en-HU/package.json +16 -0
- package/locale/en-HU.json +219 -0
- package/locale/en-HU.json.d.ts +4 -0
- package/locale/en-HU.json.js +219 -0
- package/locale/en-ID/package.json +16 -0
- package/locale/en-ID.json +219 -0
- package/locale/en-ID.json.d.ts +4 -0
- package/locale/en-ID.json.js +219 -0
- package/locale/en-IT/package.json +16 -0
- package/locale/en-IT.json +219 -0
- package/locale/en-IT.json.d.ts +4 -0
- package/locale/en-IT.json.js +219 -0
- package/locale/en-NO/package.json +16 -0
- package/locale/en-NO.json +219 -0
- package/locale/en-NO.json.d.ts +4 -0
- package/locale/en-NO.json.js +219 -0
- package/locale/en-PL/package.json +16 -0
- package/locale/en-PL.json +219 -0
- package/locale/en-PL.json.d.ts +4 -0
- package/locale/en-PL.json.js +219 -0
- package/locale/en-PT/package.json +16 -0
- package/locale/en-PT.json +219 -0
- package/locale/en-PT.json.d.ts +4 -0
- package/locale/en-PT.json.js +219 -0
- package/locale/en-RO/package.json +16 -0
- package/locale/en-RO.json +219 -0
- package/locale/en-RO.json.d.ts +4 -0
- package/locale/en-RO.json.js +219 -0
- package/locale/en-SK/package.json +16 -0
- package/locale/en-SK.json +219 -0
- package/locale/en-SK.json.d.ts +4 -0
- package/locale/en-SK.json.js +219 -0
- package/locale/es-MX.json +12 -9
- package/locale/es-MX.json.js +12 -9
- package/locale/es-SV.json +2 -2
- package/locale/es-SV.json.js +2 -2
- package/locale/eu.json +24 -24
- package/locale/eu.json.js +24 -24
- package/locale/ha.json +119 -65
- package/locale/ha.json.js +119 -65
- package/locale/he.json +0 -6
- package/locale/he.json.js +0 -6
- package/locale/hi-Latn.json +2 -2
- package/locale/hi-Latn.json.js +2 -2
- package/locale/ht/package.json +16 -0
- package/locale/ht.json +207 -0
- package/locale/ht.json.d.ts +4 -0
- package/locale/ht.json.js +207 -0
- package/locale/id.json +1 -1
- package/locale/id.json.js +1 -1
- package/locale/ie/package.json +16 -0
- package/locale/ie.json +159 -0
- package/locale/ie.json.d.ts +4 -0
- package/locale/ie.json.js +159 -0
- package/locale/ig.json +17 -17
- package/locale/ig.json.js +17 -17
- package/locale/ii/package.json +16 -0
- package/locale/ii.json +165 -0
- package/locale/ii.json.d.ts +4 -0
- package/locale/ii.json.js +165 -0
- package/locale/is.json +4 -1
- package/locale/is.json.js +4 -1
- package/locale/kaa/package.json +16 -0
- package/locale/kaa.json +159 -0
- package/locale/kaa.json.d.ts +4 -0
- package/locale/kaa.json.js +159 -0
- package/locale/kok-Latn/package.json +16 -0
- package/locale/kok-Latn.json +159 -0
- package/locale/kok-Latn.json.d.ts +4 -0
- package/locale/kok-Latn.json.js +159 -0
- package/locale/kok.json +8 -8
- package/locale/kok.json.js +8 -8
- package/locale/ks.json +9 -9
- package/locale/ks.json.js +9 -9
- package/locale/ku.json +55 -46
- package/locale/ku.json.js +55 -46
- package/locale/lld/package.json +16 -0
- package/locale/lld.json +291 -0
- package/locale/lld.json.d.ts +4 -0
- package/locale/lld.json.js +291 -0
- package/locale/mi.json +22 -22
- package/locale/mi.json.js +22 -22
- package/locale/ms-Arab/package.json +16 -0
- package/locale/ms-Arab.json +159 -0
- package/locale/ms-Arab.json.d.ts +4 -0
- package/locale/ms-Arab.json.js +159 -0
- package/locale/nb.json +2 -2
- package/locale/nb.json.js +2 -2
- package/locale/ne.json +1 -1
- package/locale/ne.json.js +1 -1
- package/locale/nn.json +4 -4
- package/locale/nn.json.js +4 -4
- package/locale/no.json +2 -2
- package/locale/no.json.js +2 -2
- package/locale/nqo/package.json +16 -0
- package/locale/nqo.json +159 -0
- package/locale/nqo.json.d.ts +4 -0
- package/locale/nqo.json.js +159 -0
- package/locale/om/package.json +16 -0
- package/locale/om.json +213 -0
- package/locale/om.json.d.ts +4 -0
- package/locale/om.json.js +213 -0
- package/locale/or.json +1 -1
- package/locale/or.json.js +1 -1
- package/locale/qu.json +46 -46
- package/locale/qu.json.js +46 -46
- package/locale/rhg/package.json +16 -0
- package/locale/rhg.json +159 -0
- package/locale/rhg.json.d.ts +4 -0
- package/locale/rhg.json.js +159 -0
- package/locale/sl.json +12 -12
- package/locale/sl.json.js +12 -12
- package/locale/sr-Cyrl-BA.json +2 -2
- package/locale/sr-Cyrl-BA.json.js +2 -2
- package/locale/sr-Latn-BA.json +2 -2
- package/locale/sr-Latn-BA.json.js +2 -2
- package/locale/sv.json +1 -1
- package/locale/sv.json.js +1 -1
- package/locale/syr/package.json +16 -0
- package/locale/syr.json +303 -0
- package/locale/syr.json.d.ts +4 -0
- package/locale/syr.json.js +303 -0
- package/locale/ti.json +6 -6
- package/locale/ti.json.js +6 -6
- package/locale/tn/package.json +16 -0
- package/locale/tn.json +159 -0
- package/locale/tn.json.d.ts +4 -0
- package/locale/tn.json.js +159 -0
- package/locale/to.json +26 -26
- package/locale/to.json.js +26 -26
- package/locale/uk.json +1 -1
- package/locale/uk.json.js +1 -1
- package/locale/ur-IN.json +9 -6
- package/locale/ur-IN.json.js +9 -6
- package/locale/vec/package.json +16 -0
- package/locale/vec.json +267 -0
- package/locale/vec.json.d.ts +4 -0
- package/locale/vec.json.js +267 -0
- package/locale/xnr/package.json +16 -0
- package/locale/xnr.json +159 -0
- package/locale/xnr.json.d.ts +4 -0
- package/locale/xnr.json.js +159 -0
- package/locale/yo-BJ.json +17 -17
- package/locale/yo-BJ.json.js +17 -17
- package/locale/yo.json +17 -17
- package/locale/yo.json.js +17 -17
- package/modules/FullDateFormatter.js +67 -0
- package/modules/FullDateFormatter.js.map +1 -0
- package/modules/FullDateFormatter.test.js +22 -0
- package/modules/FullDateFormatter.test.js.map +1 -0
- package/modules/LocaleDataStore.js +2 -3
- package/modules/LocaleDataStore.js.map +1 -1
- package/modules/PropTypes.js +11 -7
- package/modules/PropTypes.js.map +1 -1
- package/modules/TimeAgo.js +299 -237
- package/modules/TimeAgo.js.map +1 -1
- package/modules/TimeAgo.test.js +217 -119
- package/modules/TimeAgo.test.js.map +1 -1
- package/modules/cache.js +6 -22
- package/modules/cache.js.map +1 -1
- package/modules/cache.test.js.map +1 -1
- package/modules/isStyleObject.js +9 -7
- package/modules/isStyleObject.js.map +1 -1
- package/modules/isStyleObject.test.js.map +1 -1
- package/modules/locale.js +6 -16
- package/modules/locale.js.map +1 -1
- package/modules/locale.test.js +0 -4
- package/modules/locale.test.js.map +1 -1
- package/modules/round.js +2 -3
- package/modules/round.js.map +1 -1
- package/modules/steps/approximate.js +6 -2
- package/modules/steps/approximate.js.map +1 -1
- package/modules/steps/approximate.test.js +0 -2
- package/modules/steps/approximate.test.js.map +1 -1
- package/modules/steps/getStep.js +36 -48
- package/modules/steps/getStep.js.map +1 -1
- package/modules/steps/getStep.test.js +6 -2
- package/modules/steps/getStep.test.js.map +1 -1
- package/modules/steps/getStepDenominator.js +2 -3
- package/modules/steps/getStepDenominator.js.map +1 -1
- package/modules/steps/getStepDenominator.test.js.map +1 -1
- package/modules/steps/getStepMinTime.js +31 -36
- package/modules/steps/getStepMinTime.js.map +1 -1
- package/modules/steps/getStepMinTime.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.js +28 -32
- package/modules/steps/getTimeToNextUpdate.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.test.js +27 -18
- package/modules/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.js +4 -10
- package/modules/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.test.js +0 -4
- package/modules/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/modules/steps/helpers.js +1 -1
- package/modules/steps/helpers.js.map +1 -1
- package/modules/steps/helpers.test.js.map +1 -1
- package/modules/steps/index.js +2 -1
- package/modules/steps/index.js.map +1 -1
- package/modules/steps/renameLegacyProperties.js +6 -13
- package/modules/steps/renameLegacyProperties.js.map +1 -1
- package/modules/steps/renameLegacyProperties.test.js.map +1 -1
- package/modules/steps/round.js.map +1 -1
- package/modules/steps/round.test.js +0 -3
- package/modules/steps/round.test.js.map +1 -1
- package/modules/steps/units.js +5 -9
- package/modules/steps/units.js.map +1 -1
- package/modules/style/approximate.js +5 -1
- package/modules/style/approximate.js.map +1 -1
- package/modules/style/approximateTime.js +6 -2
- package/modules/style/approximateTime.js.map +1 -1
- package/modules/style/approximateTime.test.js +115 -70
- package/modules/style/approximateTime.test.js.map +1 -1
- package/modules/style/getStyleByName.js +4 -17
- package/modules/style/getStyleByName.js.map +1 -1
- package/modules/style/mini.js +8 -4
- package/modules/style/mini.js.map +1 -1
- package/modules/style/mini.test.js +14 -20
- package/modules/style/mini.test.js.map +1 -1
- package/modules/style/miniMinute.js +6 -6
- package/modules/style/miniMinute.js.map +1 -1
- package/modules/style/miniMinute.test.js +10 -12
- package/modules/style/miniMinute.test.js.map +1 -1
- package/modules/style/miniMinuteNow.js +6 -6
- package/modules/style/miniMinuteNow.js.map +1 -1
- package/modules/style/miniMinuteNow.test.js +10 -12
- package/modules/style/miniMinuteNow.test.js.map +1 -1
- package/modules/style/miniNow.js +6 -6
- package/modules/style/miniNow.js.map +1 -1
- package/modules/style/miniNow.test.js +10 -12
- package/modules/style/miniNow.test.js.map +1 -1
- package/modules/style/renameLegacyProperties.js +8 -10
- package/modules/style/renameLegacyProperties.js.map +1 -1
- package/modules/style/renameLegacyProperties.test.js +0 -1
- package/modules/style/renameLegacyProperties.test.js.map +1 -1
- package/modules/style/round.js +3 -2
- package/modules/style/round.js.map +1 -1
- package/modules/style/round.test.js +50 -62
- package/modules/style/round.test.js.map +1 -1
- package/modules/style/roundMinute.js +8 -7
- package/modules/style/roundMinute.js.map +1 -1
- package/modules/style/roundMinute.test.js +19 -22
- package/modules/style/roundMinute.test.js.map +1 -1
- package/modules/style/twitter.js +36 -33
- package/modules/style/twitter.js.map +1 -1
- package/modules/style/twitter.test.js +53 -52
- package/modules/style/twitter.test.js.map +1 -1
- package/modules/style/twitterFirstMinute.js +8 -7
- package/modules/style/twitterFirstMinute.js.map +1 -1
- package/modules/style/twitterFirstMinute.test.js +15 -18
- package/modules/style/twitterFirstMinute.test.js.map +1 -1
- package/modules/style/twitterMinute.js +6 -6
- package/modules/style/twitterMinute.js.map +1 -1
- package/modules/style/twitterMinute.test.js +19 -20
- package/modules/style/twitterMinute.test.js.map +1 -1
- package/modules/style/twitterMinuteNow.js +6 -6
- package/modules/style/twitterMinuteNow.js.map +1 -1
- package/modules/style/twitterMinuteNow.test.js +19 -20
- package/modules/style/twitterMinuteNow.test.js.map +1 -1
- package/modules/style/twitterNow.js +6 -6
- package/modules/style/twitterNow.js.map +1 -1
- package/modules/style/twitterNow.test.js +17 -19
- package/modules/style/twitterNow.test.js.map +1 -1
- package/package.json +275 -13
package/modules/style/twitter.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { intlDateTimeFormatSupported } from '../locale.js';
|
|
1
|
+
import { getDate } from '../steps/index.js';
|
|
2
|
+
import { intlDateTimeFormatSupported } from '../locale.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// // For compatibility with the old versions of this library.
|
|
5
|
+
// import renameLegacyProperties from './renameLegacyProperties.js'
|
|
6
|
+
|
|
7
|
+
// Twitter-style relative date/time formatting.
|
|
5
8
|
// ("1m", "2h", "Mar 3", "Apr 4, 2012").
|
|
6
9
|
//
|
|
7
10
|
// Seconds, minutes or hours are shown for shorter intervals,
|
|
@@ -13,15 +16,17 @@ var steps = [{
|
|
|
13
16
|
formatAs: 'minute'
|
|
14
17
|
}, {
|
|
15
18
|
formatAs: 'hour'
|
|
16
|
-
}];
|
|
17
|
-
// for various locales (is a global variable).
|
|
19
|
+
}];
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
// A cache for `Intl.DateTimeFormat` formatters
|
|
22
|
+
// for various locales (is a global variable).
|
|
23
|
+
var formatters = {};
|
|
20
24
|
|
|
25
|
+
// Starting from day intervals, output month and day.
|
|
21
26
|
var monthAndDay = {
|
|
22
27
|
minTime: function minTime(timestamp, _ref) {
|
|
23
28
|
var future = _ref.future,
|
|
24
|
-
|
|
29
|
+
getMinTimeForUnit = _ref.getMinTimeForUnit;
|
|
25
30
|
// Returns `23.5 * 60 * 60` when `round` is "round",
|
|
26
31
|
// and `24 * 60 * 60` when `round` is "floor".
|
|
27
32
|
return getMinTimeForUnit('day');
|
|
@@ -32,27 +37,24 @@ var monthAndDay = {
|
|
|
32
37
|
formatters[locale] = {};
|
|
33
38
|
}
|
|
34
39
|
/* istanbul ignore else */
|
|
35
|
-
|
|
36
|
-
|
|
37
40
|
if (!formatters[locale].dayMonth) {
|
|
38
41
|
// "Apr 11" (MMMd)
|
|
39
42
|
formatters[locale].dayMonth = new Intl.DateTimeFormat(locale, {
|
|
40
43
|
month: 'short',
|
|
41
44
|
day: 'numeric'
|
|
42
45
|
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
}
|
|
47
|
+
// Output month and day.
|
|
46
48
|
return formatters[locale].dayMonth.format(getDate(value));
|
|
47
49
|
}
|
|
48
|
-
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// If the `date` happened/happens outside of current year,
|
|
49
53
|
// then output day, month and year.
|
|
50
54
|
// The interval should be such that the `date` lies outside of the current year.
|
|
51
|
-
|
|
52
55
|
var yearMonthAndDay = {
|
|
53
56
|
minTime: function minTime(timestamp, _ref2) {
|
|
54
57
|
var future = _ref2.future;
|
|
55
|
-
|
|
56
58
|
if (future) {
|
|
57
59
|
// January 1, 00:00, of the `date`'s year is right after
|
|
58
60
|
// the maximum `now` for formatting a future date:
|
|
@@ -61,8 +63,8 @@ var yearMonthAndDay = {
|
|
|
61
63
|
// After that, it's hours, minutes, seconds, and after that it's no longer `future`.
|
|
62
64
|
// The date is right after the maximum `now` for formatting a future date,
|
|
63
65
|
// so subtract 1 millisecond from it.
|
|
64
|
-
var maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1;
|
|
65
|
-
|
|
66
|
+
var maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1;
|
|
67
|
+
// Return `minTime` (in seconds).
|
|
66
68
|
return (timestamp - maxFittingNow) / 1000;
|
|
67
69
|
} else {
|
|
68
70
|
// January 1, 00:00, of the year following the `date`'s year
|
|
@@ -70,8 +72,8 @@ var yearMonthAndDay = {
|
|
|
70
72
|
// When `now` is before that date, the `date` is formatted as "day/month" (another step),
|
|
71
73
|
// When `now` is equal to or after that date, the `date` is formatted as "day/month/year" (this step).
|
|
72
74
|
// After that, it's hours, minutes, seconds, and after that it's no longer `future`.
|
|
73
|
-
var minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime();
|
|
74
|
-
|
|
75
|
+
var minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime();
|
|
76
|
+
// Return `minTime` (in seconds).
|
|
75
77
|
return (minFittingNow - timestamp) / 1000;
|
|
76
78
|
}
|
|
77
79
|
},
|
|
@@ -81,8 +83,6 @@ var yearMonthAndDay = {
|
|
|
81
83
|
formatters[locale] = {};
|
|
82
84
|
}
|
|
83
85
|
/* istanbul ignore else */
|
|
84
|
-
|
|
85
|
-
|
|
86
86
|
if (!formatters[locale].dayMonthYear) {
|
|
87
87
|
// "Apr 11, 2017" (yMMMd)
|
|
88
88
|
formatters[locale].dayMonthYear = new Intl.DateTimeFormat(locale, {
|
|
@@ -90,19 +90,19 @@ var yearMonthAndDay = {
|
|
|
90
90
|
month: 'short',
|
|
91
91
|
day: 'numeric'
|
|
92
92
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
}
|
|
94
|
+
// Output day, month and year.
|
|
96
95
|
return formatters[locale].dayMonthYear.format(getDate(value));
|
|
97
96
|
}
|
|
98
|
-
};
|
|
99
|
-
// then longer time intervals will be formatted as dates.
|
|
97
|
+
};
|
|
100
98
|
|
|
99
|
+
// If `Intl.DateTimeFormat` is supported,
|
|
100
|
+
// then longer time intervals will be formatted as dates.
|
|
101
101
|
/* istanbul ignore else */
|
|
102
|
-
|
|
103
102
|
if (intlDateTimeFormatSupported()) {
|
|
104
103
|
steps.push(monthAndDay, yearMonthAndDay);
|
|
105
|
-
}
|
|
104
|
+
}
|
|
105
|
+
// Otherwise, if `Intl.DateTimeFormat` is not supported,
|
|
106
106
|
// which could be the case when using Internet Explorer,
|
|
107
107
|
// then simply mimick "round" steps.
|
|
108
108
|
else {
|
|
@@ -116,18 +116,21 @@ else {
|
|
|
116
116
|
formatAs: 'year'
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
|
|
120
119
|
export default {
|
|
121
120
|
steps: steps,
|
|
122
|
-
labels: [
|
|
123
|
-
|
|
124
|
-
'
|
|
121
|
+
labels: [
|
|
122
|
+
// "mini" labels are only defined for a few languages.
|
|
123
|
+
'mini',
|
|
124
|
+
// "short-time" labels are only defined for a few languages.
|
|
125
|
+
'short-time',
|
|
126
|
+
// "narrow" and "short" labels are defined for all languages.
|
|
125
127
|
// "narrow" labels can sometimes be weird (like "+5d."),
|
|
126
128
|
// but "short" labels have the " ago" part, so "narrow" seem
|
|
127
129
|
// more appropriate.
|
|
128
130
|
// "short" labels would have been more appropriate if they
|
|
129
131
|
// didn't have the " ago" part, hence the "short-time" above.
|
|
130
|
-
'narrow',
|
|
132
|
+
'narrow',
|
|
133
|
+
// Since "narrow" labels are always present, "short" element
|
|
131
134
|
// of this array can be removed.
|
|
132
135
|
'short']
|
|
133
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twitter.js","names":["
|
|
1
|
+
{"version":3,"file":"twitter.js","names":["getDate","intlDateTimeFormatSupported","steps","formatAs","formatters","monthAndDay","minTime","timestamp","_ref","future","getMinTimeForUnit","format","value","locale","dayMonth","Intl","DateTimeFormat","month","day","yearMonthAndDay","_ref2","maxFittingNow","Date","getFullYear","getTime","minFittingNow","dayMonthYear","year","push","labels"],"sources":["../../source/style/twitter.js"],"sourcesContent":["import { getDate } from '../steps/index.js'\r\nimport { intlDateTimeFormatSupported } from '../locale.js'\r\n\r\n// // For compatibility with the old versions of this library.\r\n// import renameLegacyProperties from './renameLegacyProperties.js'\r\n\r\n// Twitter-style relative date/time formatting.\r\n// (\"1m\", \"2h\", \"Mar 3\", \"Apr 4, 2012\").\r\n//\r\n// Seconds, minutes or hours are shown for shorter intervals,\r\n// and longer intervals are formatted using full date format.\r\n\r\nconst steps = [\r\n\t{\r\n\t\tformatAs: 'second'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'minute'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'hour'\r\n\t}\r\n]\r\n\r\n// A cache for `Intl.DateTimeFormat` formatters\r\n// for various locales (is a global variable).\r\nconst formatters = {}\r\n\r\n// Starting from day intervals, output month and day.\r\nconst monthAndDay = {\r\n\tminTime(timestamp, { future, getMinTimeForUnit }) {\r\n\t\t// Returns `23.5 * 60 * 60` when `round` is \"round\",\r\n\t\t// and `24 * 60 * 60` when `round` is \"floor\".\r\n\t\treturn getMinTimeForUnit('day')\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonth) {\r\n\t\t\t// \"Apr 11\" (MMMd)\r\n\t\t\tformatters[locale].dayMonth = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output month and day.\r\n\t\treturn formatters[locale].dayMonth.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If the `date` happened/happens outside of current year,\r\n// then output day, month and year.\r\n// The interval should be such that the `date` lies outside of the current year.\r\nconst yearMonthAndDay = {\r\n\tminTime(timestamp, { future }) {\r\n\t\tif (future) {\r\n\t\t\t// January 1, 00:00, of the `date`'s year is right after\r\n\t\t\t// the maximum `now` for formatting a future date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month/year\" (this step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month\" (another step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\t// The date is right after the maximum `now` for formatting a future date,\r\n\t\t\t// so subtract 1 millisecond from it.\r\n\t\t\tconst maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (timestamp - maxFittingNow) / 1000\r\n\t\t} else {\r\n\t\t\t// January 1, 00:00, of the year following the `date`'s year\r\n\t\t\t// is the minimum `now` for formatting a past date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month\" (another step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month/year\" (this step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\tconst minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime()\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (minFittingNow - timestamp) / 1000\r\n\t\t}\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore if */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonthYear) {\r\n\t\t\t// \"Apr 11, 2017\" (yMMMd)\r\n\t\t\tformatters[locale].dayMonthYear = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tyear: 'numeric',\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output day, month and year.\r\n\t\treturn formatters[locale].dayMonthYear.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If `Intl.DateTimeFormat` is supported,\r\n// then longer time intervals will be formatted as dates.\r\n/* istanbul ignore else */\r\nif (intlDateTimeFormatSupported()) {\r\n\tsteps.push(monthAndDay, yearMonthAndDay)\r\n}\r\n// Otherwise, if `Intl.DateTimeFormat` is not supported,\r\n// which could be the case when using Internet Explorer,\r\n// then simply mimick \"round\" steps.\r\nelse {\r\n\tsteps.push(\r\n\t\t{\r\n\t\t\tformatAs: 'day'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'week'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'month'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'year'\r\n\t\t}\r\n\t)\r\n}\r\n\r\nexport default {\r\n\tsteps,\r\n\tlabels: [\r\n\t\t// \"mini\" labels are only defined for a few languages.\r\n\t\t'mini',\r\n\t\t// \"short-time\" labels are only defined for a few languages.\r\n\t\t'short-time',\r\n\t\t// \"narrow\" and \"short\" labels are defined for all languages.\r\n\t\t// \"narrow\" labels can sometimes be weird (like \"+5d.\"),\r\n\t\t// but \"short\" labels have the \" ago\" part, so \"narrow\" seem\r\n\t\t// more appropriate.\r\n\t\t// \"short\" labels would have been more appropriate if they\r\n\t\t// didn't have the \" ago\" part, hence the \"short-time\" above.\r\n\t\t'narrow',\r\n\t\t// Since \"narrow\" labels are always present, \"short\" element\r\n\t\t// of this array can be removed.\r\n\t\t'short'\r\n\t]\r\n}"],"mappings":"AAAA,SAASA,O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EACX,CAAC,EACD;IACCA,QAAQ,EAAE;EACX,CAAC,EACD;IACCA,QAAQ,EAAE;EACX,CACD,CAAC;AACF;AAEA,eAAe;EACdD,KAAK,EAALA,KAAK;EACL2B,MAAM,EAAE;EACP;EACA,MAAM;EACN;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,OAAO;AAET,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
function _objectSpread(
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import twitter from './twitter.js';
|
|
8
8
|
import TimeAgo from '../TimeAgo.js';
|
|
9
9
|
import { hour, minute, day, month, year } from '../steps/index.js';
|
|
@@ -14,30 +14,27 @@ describe('style/twitter', function () {
|
|
|
14
14
|
});
|
|
15
15
|
it('should format Twitter style relative time (English) (round: "round")', function () {
|
|
16
16
|
var timeAgo = new TimeAgo('en');
|
|
17
|
-
|
|
18
17
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
19
18
|
return timeAgo.format(-secondsPassed * 1000, _objectSpread({
|
|
20
19
|
now: 0
|
|
21
20
|
}, twitter));
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
formatDatePastBy(0.49).should.equal('0s');
|
|
25
23
|
formatDatePastBy(0.5).should.equal('1s');
|
|
26
24
|
formatDatePastBy(59.49).should.equal('59s');
|
|
27
25
|
formatDatePastBy(59.5).should.equal('1m');
|
|
28
26
|
formatDatePastBy(1.49 * minute).should.equal('1m');
|
|
29
|
-
formatDatePastBy(1.5 * minute).should.equal('2m');
|
|
30
|
-
|
|
27
|
+
formatDatePastBy(1.5 * minute).should.equal('2m');
|
|
28
|
+
// โฆ
|
|
31
29
|
formatDatePastBy(59.49 * minute).should.equal('59m');
|
|
32
30
|
formatDatePastBy(59.5 * minute).should.equal('1h');
|
|
33
31
|
formatDatePastBy(1.49 * hour).should.equal('1h');
|
|
34
|
-
formatDatePastBy(1.5 * hour).should.equal('2h');
|
|
35
|
-
|
|
32
|
+
formatDatePastBy(1.5 * hour).should.equal('2h');
|
|
33
|
+
// โฆ
|
|
36
34
|
formatDatePastBy(23.49 * hour).should.equal('23h');
|
|
37
35
|
});
|
|
38
36
|
it('should format Twitter style relative time (English) (round: "floor")', function () {
|
|
39
37
|
var timeAgo = new TimeAgo('en');
|
|
40
|
-
|
|
41
38
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
42
39
|
return timeAgo.format(-secondsPassed * 1000, _objectSpread(_objectSpread({
|
|
43
40
|
now: 0
|
|
@@ -45,7 +42,6 @@ describe('style/twitter', function () {
|
|
|
45
42
|
round: 'floor'
|
|
46
43
|
}));
|
|
47
44
|
};
|
|
48
|
-
|
|
49
45
|
formatDatePastBy(0).should.equal('0s');
|
|
50
46
|
formatDatePastBy(0.9).should.equal('0s');
|
|
51
47
|
formatDatePastBy(1).should.equal('1s');
|
|
@@ -54,49 +50,47 @@ describe('style/twitter', function () {
|
|
|
54
50
|
formatDatePastBy(1.9 * minute).should.equal('1m');
|
|
55
51
|
formatDatePastBy(2 * minute).should.equal('2m');
|
|
56
52
|
formatDatePastBy(2.9 * minute).should.equal('2m');
|
|
57
|
-
formatDatePastBy(3 * minute).should.equal('3m');
|
|
58
|
-
|
|
53
|
+
formatDatePastBy(3 * minute).should.equal('3m');
|
|
54
|
+
// โฆ
|
|
59
55
|
formatDatePastBy(59.9 * minute).should.equal('59m');
|
|
60
56
|
formatDatePastBy(60 * minute).should.equal('1h');
|
|
61
57
|
formatDatePastBy(1.9 * hour).should.equal('1h');
|
|
62
58
|
formatDatePastBy(2 * hour).should.equal('2h');
|
|
63
59
|
formatDatePastBy(2.9 * hour).should.equal('2h');
|
|
64
|
-
formatDatePastBy(3 * hour).should.equal('3h');
|
|
65
|
-
|
|
60
|
+
formatDatePastBy(3 * hour).should.equal('3h');
|
|
61
|
+
// โฆ
|
|
66
62
|
formatDatePastBy(23.9 * hour).should.equal('23h');
|
|
67
63
|
});
|
|
68
64
|
it('should format Twitter style relative time (English) (absolute dates)', function () {
|
|
69
|
-
var timeAgo = new TimeAgo('en');
|
|
65
|
+
var timeAgo = new TimeAgo('en');
|
|
70
66
|
|
|
67
|
+
// April 10th, 2016, 12:00.
|
|
71
68
|
var now = new Date(2016, 3, 10, 12, 0).getTime();
|
|
72
|
-
|
|
73
69
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
74
70
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
75
71
|
now: now
|
|
76
72
|
}, twitter));
|
|
77
73
|
};
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
formatDatePastBy(day + 2 * minute + hour).should.equal('Apr 9');
|
|
75
|
+
// โฆ
|
|
80
76
|
// `month` is about 30.5 days.
|
|
81
|
-
|
|
82
77
|
formatDatePastBy(month * 3).should.equal('Jan 10');
|
|
83
78
|
formatDatePastBy(month * 4).should.equal('Dec 10, 2015');
|
|
84
|
-
formatDatePastBy(year).should.equal('Apr 11, 2015');
|
|
85
|
-
// `month` is about 30.5 days.
|
|
79
|
+
formatDatePastBy(year).should.equal('Apr 11, 2015');
|
|
86
80
|
|
|
81
|
+
// Test future dates.
|
|
82
|
+
// `month` is about 30.5 days.
|
|
87
83
|
formatDatePastBy(-1 * month * 8).should.equal('Dec 10');
|
|
88
84
|
formatDatePastBy(-1 * month * 9).should.equal('Jan 9, 2017');
|
|
89
85
|
});
|
|
90
86
|
it('should format Twitter style relative time (Russian)', function () {
|
|
91
87
|
var timeAgo = new TimeAgo('ru');
|
|
92
88
|
var now = new Date(2016, 3, 10, 22, 59).getTime();
|
|
93
|
-
|
|
94
89
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
95
90
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
96
91
|
now: now
|
|
97
92
|
}, twitter));
|
|
98
93
|
};
|
|
99
|
-
|
|
100
94
|
formatDatePastBy(0).should.equal('0 ั');
|
|
101
95
|
formatDatePastBy(1).should.equal('1 ั');
|
|
102
96
|
formatDatePastBy(minute).should.equal('1 ะผะธะฝ');
|
|
@@ -107,13 +101,11 @@ describe('style/twitter', function () {
|
|
|
107
101
|
it('should format Twitter style relative time (Korean)', function () {
|
|
108
102
|
var timeAgo = new TimeAgo('ko');
|
|
109
103
|
var now = new Date(2016, 3, 10, 22, 59).getTime();
|
|
110
|
-
|
|
111
104
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
112
105
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
113
106
|
now: now
|
|
114
107
|
}, twitter));
|
|
115
108
|
};
|
|
116
|
-
|
|
117
109
|
formatDatePastBy(minute).should.equal('1๋ถ');
|
|
118
110
|
formatDatePastBy(hour).should.equal('1์๊ฐ');
|
|
119
111
|
formatDatePastBy(day + 62 * minute).should.equal('4์ 9์ผ');
|
|
@@ -122,13 +114,11 @@ describe('style/twitter', function () {
|
|
|
122
114
|
it('should format Twitter style relative time (German)', function () {
|
|
123
115
|
var timeAgo = new TimeAgo('de');
|
|
124
116
|
var now = new Date(2016, 3, 10, 22, 59).getTime();
|
|
125
|
-
|
|
126
117
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
127
118
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
128
119
|
now: now
|
|
129
120
|
}, twitter));
|
|
130
121
|
};
|
|
131
|
-
|
|
132
122
|
formatDatePastBy(minute).should.equal('1 Min.');
|
|
133
123
|
formatDatePastBy(hour).should.equal('1 Std.');
|
|
134
124
|
formatDatePastBy(day + 62 * minute).should.equal('9. Apr.');
|
|
@@ -137,13 +127,11 @@ describe('style/twitter', function () {
|
|
|
137
127
|
it('should format Twitter style relative time (French)', function () {
|
|
138
128
|
var timeAgo = new TimeAgo('fr');
|
|
139
129
|
var now = new Date(2016, 3, 10, 22, 59).getTime();
|
|
140
|
-
|
|
141
130
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
142
131
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
143
132
|
now: now
|
|
144
133
|
}, twitter));
|
|
145
134
|
};
|
|
146
|
-
|
|
147
135
|
formatDatePastBy(minute).should.equal('1 min.');
|
|
148
136
|
formatDatePastBy(hour).should.equal('1 h');
|
|
149
137
|
formatDatePastBy(day + 62 * minute).should.equal('9 avr.');
|
|
@@ -152,18 +140,18 @@ describe('style/twitter', function () {
|
|
|
152
140
|
it('should format Twitter style relative time (Chinese)', function () {
|
|
153
141
|
var timeAgo = new TimeAgo('zh');
|
|
154
142
|
var now = new Date(2016, 3, 10, 22, 59).getTime();
|
|
155
|
-
|
|
156
143
|
var formatDatePastBy = function formatDatePastBy(secondsPassed) {
|
|
157
144
|
return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
|
|
158
145
|
now: now
|
|
159
146
|
}, twitter));
|
|
160
147
|
};
|
|
161
|
-
|
|
162
148
|
formatDatePastBy(minute).should.equal('1ๅ้');
|
|
163
149
|
formatDatePastBy(hour).should.equal('1ๅฐๆถ');
|
|
164
150
|
formatDatePastBy(day + 62 * minute).should.equal('4ๆ9ๆฅ');
|
|
165
151
|
formatDatePastBy(year).should.equal('2015ๅนด4ๆ11ๆฅ');
|
|
166
|
-
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// This test won't pass because `Intl.DateTimeFormat` is read at
|
|
167
155
|
// initialization time, not at run time.
|
|
168
156
|
// it('should fall back to generic style when Intl.DateTimeFormat is not available', () => {
|
|
169
157
|
// const DateTimeFormat = Intl.DateTimeFormat
|
|
@@ -181,14 +169,12 @@ describe('style/twitter', function () {
|
|
|
181
169
|
});
|
|
182
170
|
it('should round as "floor"', function () {
|
|
183
171
|
var timeAgo = new TimeAgo('en');
|
|
184
|
-
|
|
185
172
|
var test = function test(time, result) {
|
|
186
173
|
return timeAgo.format(time, 'twitter', {
|
|
187
174
|
round: 'floor',
|
|
188
175
|
now: 0
|
|
189
176
|
}).should.equal(result);
|
|
190
177
|
};
|
|
191
|
-
|
|
192
178
|
test(2001, '2s');
|
|
193
179
|
test(2000, '2s');
|
|
194
180
|
test(1999, '1s');
|
|
@@ -204,51 +190,66 @@ describe('style/twitter', function () {
|
|
|
204
190
|
test(-2001, '2s');
|
|
205
191
|
});
|
|
206
192
|
it('should get time to next update (round: "floor")', function () {
|
|
207
|
-
var timeAgo = new TimeAgo('en');
|
|
193
|
+
var timeAgo = new TimeAgo('en');
|
|
208
194
|
|
|
209
|
-
|
|
195
|
+
// April 10th, 2018, 12:00.
|
|
196
|
+
var date = new Date(2018, 3, 10, 12, 0);
|
|
210
197
|
|
|
198
|
+
// April 10th, 2016, 12:00 (two years earlier).
|
|
211
199
|
var now = new Date(2016, 3, 10, 12, 0).getTime();
|
|
212
200
|
timeAgo.format(date, 'twitter', {
|
|
213
201
|
now: now,
|
|
214
|
-
getTimeToNextUpdate: true
|
|
215
|
-
|
|
216
|
-
|
|
202
|
+
getTimeToNextUpdate: true,
|
|
203
|
+
getTimeToNextUpdateUncapped: true
|
|
204
|
+
}).should.deep.equal(['Apr 10, 2018',
|
|
205
|
+
// Updates on Jan 1st, 2018, 00:00.
|
|
206
|
+
new Date(2018, 0, 1).getTime() - now]);
|
|
217
207
|
|
|
208
|
+
// 1st, 2018, 00:00.
|
|
218
209
|
now = new Date(2018, 0, 1).getTime();
|
|
219
210
|
timeAgo.format(date, 'twitter', {
|
|
220
211
|
now: now,
|
|
221
212
|
getTimeToNextUpdate: true,
|
|
213
|
+
getTimeToNextUpdateUncapped: true,
|
|
222
214
|
round: 'floor'
|
|
223
|
-
}).should.deep.equal(['Apr 10',
|
|
224
|
-
|
|
215
|
+
}).should.deep.equal(['Apr 10',
|
|
216
|
+
// Updates after April 9th, 2018, 12:00.
|
|
217
|
+
new Date(2018, 3, 9, 12, 0).getTime() + 1 - now]);
|
|
225
218
|
|
|
219
|
+
// After April 9th, 2018, 12:00.
|
|
226
220
|
now = new Date(2018, 3, 9, 12, 0).getTime() + 1;
|
|
227
221
|
timeAgo.format(date, 'twitter', {
|
|
228
222
|
now: now,
|
|
229
223
|
getTimeToNextUpdate: true,
|
|
230
224
|
round: 'floor'
|
|
231
|
-
}).should.deep.equal(['23h',
|
|
225
|
+
}).should.deep.equal(['23h',
|
|
226
|
+
// Updates in an hour.
|
|
232
227
|
60 * 60 * 1000]);
|
|
233
228
|
});
|
|
234
229
|
it('should get time to next update (round: "round")', function () {
|
|
235
|
-
var timeAgo = new TimeAgo('en');
|
|
230
|
+
var timeAgo = new TimeAgo('en');
|
|
236
231
|
|
|
232
|
+
// April 10th, 2018, 12:00.
|
|
237
233
|
var date = new Date(2018, 3, 10, 12, 0);
|
|
238
|
-
var now;
|
|
234
|
+
var now;
|
|
239
235
|
|
|
236
|
+
// 1st, 2018, 00:00.
|
|
240
237
|
now = new Date(2018, 0, 1).getTime();
|
|
241
238
|
timeAgo.format(date, 'twitter', {
|
|
242
239
|
now: now,
|
|
243
|
-
getTimeToNextUpdate: true
|
|
244
|
-
|
|
245
|
-
|
|
240
|
+
getTimeToNextUpdate: true,
|
|
241
|
+
getTimeToNextUpdateUncapped: true
|
|
242
|
+
}).should.deep.equal(['Apr 10',
|
|
243
|
+
// Updates after April 9th, 2018, 11:30.
|
|
244
|
+
new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1 - now]);
|
|
246
245
|
|
|
246
|
+
// After April 9th, 2018, 12:00.
|
|
247
247
|
now = new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1;
|
|
248
248
|
timeAgo.format(date, 'twitter', {
|
|
249
249
|
now: now,
|
|
250
250
|
getTimeToNextUpdate: true
|
|
251
|
-
}).should.deep.equal(['23h',
|
|
251
|
+
}).should.deep.equal(['23h',
|
|
252
|
+
// Updates in an hour.
|
|
252
253
|
60 * 60 * 1000]);
|
|
253
254
|
});
|
|
254
255
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twitter.test.js","names":["twitter","TimeAgo","hour","minute","day","month","year","describe","it","timeAgo","format","Date","now","should","include","formatDatePastBy","secondsPassed","equal","round","getTime","test","time","result","date","getTimeToNextUpdate","deep"],"sources":["../../source/style/twitter.test.js"],"sourcesContent":["import twitter from './twitter.js'\r\nimport TimeAgo from '../TimeAgo.js'\r\nimport { hour, minute, day, month, year } from '../steps/index.js'\r\n\r\ndescribe('style/twitter', () => {\r\n\tit('should fallback from \"mini\" to \"narrow\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('ccp')\r\n\t\ttimeAgo.format(Date.now() - 3 * hour * 1000, 'twitter').should.include(' ๐๐ฎ๐๐ด๐ ๐๐๐ฌ')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(-secondsPassed * 1000, { now: 0, ...twitter })\r\n\r\n\t\tformatDatePastBy(0.49).should.equal('0s')\r\n\t\tformatDatePastBy(0.5).should.equal('1s')\r\n\t\tformatDatePastBy(59.49).should.equal('59s')\r\n\t\tformatDatePastBy(59.5).should.equal('1m')\r\n\t\tformatDatePastBy(1.49 * minute).should.equal('1m')\r\n\t\tformatDatePastBy(1.5 * minute).should.equal('2m')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(59.49 * minute).should.equal('59m')\r\n\t\tformatDatePastBy(59.5 * minute).should.equal('1h')\r\n\t\tformatDatePastBy(1.49 * hour).should.equal('1h')\r\n\t\tformatDatePastBy(1.5 * hour).should.equal('2h')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(23.49 * hour).should.equal('23h')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(-secondsPassed * 1000, { now: 0, ...twitter, round: 'floor' })\r\n\r\n\t\tformatDatePastBy(0).should.equal('0s')\r\n\t\tformatDatePastBy(0.9).should.equal('0s')\r\n\t\tformatDatePastBy(1).should.equal('1s')\r\n\t\tformatDatePastBy(59.9).should.equal('59s')\r\n\t\tformatDatePastBy(60).should.equal('1m')\r\n\t\tformatDatePastBy(1.9 * minute).should.equal('1m')\r\n\t\tformatDatePastBy(2 * minute).should.equal('2m')\r\n\t\tformatDatePastBy(2.9 * minute).should.equal('2m')\r\n\t\tformatDatePastBy(3 * minute).should.equal('3m')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(59.9 * minute).should.equal('59m')\r\n\t\tformatDatePastBy(60 * minute).should.equal('1h')\r\n\t\tformatDatePastBy(1.9 * hour).should.equal('1h')\r\n\t\tformatDatePastBy(2 * hour).should.equal('2h')\r\n\t\tformatDatePastBy(2.9 * hour).should.equal('2h')\r\n\t\tformatDatePastBy(3 * hour).should.equal('3h')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(23.9 * hour).should.equal('23h')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (absolute dates)', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2016, 12:00.\r\n\t\tconst now = new Date(2016, 3, 10, 12, 0).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(day + 2 * minute + hour).should.equal('Apr 9')\r\n\t\t// โฆ\r\n\t\t// `month` is about 30.5 days.\r\n\t\tformatDatePastBy(month * 3).should.equal('Jan 10')\r\n\t\tformatDatePastBy(month * 4).should.equal('Dec 10, 2015')\r\n\t\tformatDatePastBy(year).should.equal('Apr 11, 2015')\r\n\r\n\t\t// Test future dates.\r\n\t\t// `month` is about 30.5 days.\r\n\t\tformatDatePastBy(-1 * month * 8).should.equal('Dec 10')\r\n\t\tformatDatePastBy(-1 * month * 9).should.equal('Jan 9, 2017')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Russian)', () => {\r\n\t\tconst timeAgo = new TimeAgo('ru')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(0).should.equal('0 ั')\r\n\t\tformatDatePastBy(1).should.equal('1 ั')\r\n\t\tformatDatePastBy(minute).should.equal('1 ะผะธะฝ')\r\n\t\tformatDatePastBy(hour).should.equal('1 ั')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9 ะฐะฟั.')\r\n\t\tformatDatePastBy(year).should.equal('11 ะฐะฟั. 2015 ะณ.')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Korean)', () => {\r\n\t\tconst timeAgo = new TimeAgo('ko')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1๋ถ')\r\n\t\tformatDatePastBy(hour).should.equal('1์๊ฐ')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('4์ 9์ผ')\r\n\t\tformatDatePastBy(year).should.equal('2015๋
4์ 11์ผ')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (German)', () => {\r\n\t\tconst timeAgo = new TimeAgo('de')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1 Min.')\r\n\t\tformatDatePastBy(hour).should.equal('1 Std.')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9. Apr.')\r\n\t\tformatDatePastBy(year).should.equal('11. Apr. 2015')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (French)', () => {\r\n\t\tconst timeAgo = new TimeAgo('fr')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1 min.')\r\n\t\tformatDatePastBy(hour).should.equal('1 h')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9 avr.')\r\n\t\tformatDatePastBy(year).should.equal('11 avr. 2015')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Chinese)', () => {\r\n\t\tconst timeAgo = new TimeAgo('zh')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1ๅ้')\r\n\t\tformatDatePastBy(hour).should.equal('1ๅฐๆถ')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('4ๆ9ๆฅ')\r\n\t\tformatDatePastBy(year).should.equal('2015ๅนด4ๆ11ๆฅ')\r\n\t})\r\n\r\n\t// This test won't pass because `Intl.DateTimeFormat` is read at\r\n\t// initialization time, not at run time.\r\n\t// it('should fall back to generic style when Intl.DateTimeFormat is not available', () => {\r\n\t// \tconst DateTimeFormat = Intl.DateTimeFormat\r\n\t// \tIntl.DateTimeFormat = undefined\r\n\t//\r\n\t// \tconst timeAgo = new TimeAgo('en')\r\n\t// \ttimeAgo.format(Date.now() - 365 * 24 * hour * 1000, 'twitter').should.equal('1yr')\r\n\t//\r\n\t// \tIntl.DateTimeFormat = DateTimeFormat\r\n\t// })\r\n\r\n\tit('should support timestamp argument on `yearMonthAndDay.test()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(0, 'twitter').should.equal('Jan 1, 1970')\r\n\t})\r\n\r\n\tit('should round as \"floor\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst test = (time, result) => timeAgo.format(time, 'twitter', {\r\n\t\t\tround: 'floor',\r\n\t\t\tnow: 0\r\n\t\t}).should.equal(result)\r\n\t\ttest(2001, '2s')\r\n\t\ttest(2000, '2s')\r\n\t\ttest(1999, '1s')\r\n\t\ttest(1001, '1s')\r\n\t\ttest(1000, '1s')\r\n\t\ttest(999, '0s')\r\n\t\ttest(0, '0s')\r\n\t\ttest(-999, '0s')\r\n\t\ttest(-1000, '1s')\r\n\t\ttest(-1001, '1s')\r\n\t\ttest(-1999, '1s')\r\n\t\ttest(-2000, '2s')\r\n\t\ttest(-2001, '2s')\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2018, 12:00.\r\n\t\tconst date = new Date(2018, 3, 10, 12, 0)\r\n\r\n\t\t// April 10th, 2016, 12:00 (two years earlier).\r\n\t\tlet now = new Date(2016, 3, 10, 12, 0).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10, 2018',\r\n\t\t\t// Updates on Jan 1st, 2018, 00:00.\r\n\t\t\tnew Date(2018, 0, 1).getTime() - now\r\n\t\t])\r\n\r\n\t\t// 1st, 2018, 00:00.\r\n\t\tnow = new Date(2018, 0, 1).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tround: 'floor'\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10',\r\n\t\t\t// Updates after April 9th, 2018, 12:00.\r\n\t\t\t(new Date(2018, 3, 9, 12, 0).getTime() + 1) - now\r\n\t\t])\r\n\r\n\t\t// After April 9th, 2018, 12:00.\r\n\t\tnow = new Date(2018, 3, 9, 12, 0).getTime() + 1\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tround: 'floor'\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'23h',\r\n\t\t\t// Updates in an hour.\r\n\t\t\t60 * 60 * 1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2018, 12:00.\r\n\t\tconst date = new Date(2018, 3, 10, 12, 0)\r\n\r\n\t\tlet now\r\n\r\n\t\t// 1st, 2018, 00:00.\r\n\t\tnow = new Date(2018, 0, 1).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10',\r\n\t\t\t// Updates after April 9th, 2018, 11:30.\r\n\t\t\t(new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1) - now\r\n\t\t])\r\n\r\n\t\t// After April 9th, 2018, 12:00.\r\n\t\tnow = new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'23h',\r\n\t\t\t// Updates in an hour.\r\n\t\t\t60 * 60 * 1000\r\n\t\t])\r\n\t})\r\n})"],"mappings":";;;;;;AAAA,OAAOA,OAAP,MAAoB,cAApB;AACA,OAAOC,OAAP,MAAoB,eAApB;AACA,SAASC,IAAT,EAAeC,MAAf,EAAuBC,GAAvB,EAA4BC,KAA5B,EAAmCC,IAAnC,QAA+C,mBAA/C;AAEAC,QAAQ,CAAC,eAAD,EAAkB,YAAM;EAC/BC,EAAE,CAAC,yCAAD,EAA4C,YAAM;IACnD,IAAMC,OAAO,GAAG,IAAIR,OAAJ,CAAY,KAAZ,CAAhB;IACAQ,OAA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AM;IAC3D,IAAMC,OAAO,GAAG,IAAIR,OAAJ,CAAY,IAAZ,CAAhB,CAD2D,CAG3D;;IACA,IAAMsB,IAAI,GAAG,IAAIZ,IAAJ,CAAS,IAAT,EAAe,CAAf,EAAkB,EAAlB,EAAsB,EAAtB,EAA0B,CAA1B,CAAb;IAEA,IAAIC,GAAJ,CAN2D,CAQ3D;;IACAA,GAAG,GAAG,IAAID,IAAJ,CAAS,IAAT,EAAe,CAAf,EAAkB,CAAlB,EAAqBQ,OAArB,EAAN;IAEAV,OAAO,CAACC,MAAR,CACCa,IADD,EAEC,SAFD,EAGC;MACCX,GAAG,EAAHA,GADD;MAECY,mBAAmB,EAAE;IAFtB,CAHD,EAOEX,MAPF,CAOSY,IAPT,CAOcR,KAPd,CAOoB,CACnB,QADmB,EAEnB;IACC,IAAIN,IAAJ,CAAS,IAAT,EAAe,CAAf,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4BQ,OAA5B,KAAwC,KAAK,EAAL,GAAU,IAAlD,GAAyD,CAA1D,GAA+DP,GAH5C,CAPpB,EAX2D,CAwB3D;;IACAA,GAAG,GAAG,IAAID,IAAJ,CAAS,IAAT,EAAe,CAAf,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4BQ,OAA5B,KAAwC,KAAK,EAAL,GAAU,IAAlD,GAAyD,CAA/D;IAEAV,OAAO,CAACC,MAAR,CACCa,IADD,EAEC,SAFD,EAGC;MACCX,GAAG,EAAHA,GADD;MAECY,mBAAmB,EAAE;IAFtB,CAHD,EAOEX,MAPF,CAOSY,IAPT,CAOcR,KAPd,CAOoB,CACnB,KADmB,EAEnB;IACA,KAAK,EAAL,GAAU,IAHS,CAPpB;EAYA,CAvCC,CAAF;AAwCA,CA5QO,CAAR"}
|
|
1
|
+
{"version":3,"file":"twitter.test.js","names":["twitter","TimeAgo","hour","minute","day","month","year","describe","it","timeAgo","format","Date","now","should","include","formatDatePastBy","secondsPassed","_objectSpread","equal","round","getTime","test","time","result","date","getTimeToNextUpdate","getTimeToNextUpdateUncapped","deep"],"sources":["../../source/style/twitter.test.js"],"sourcesContent":["import twitter from './twitter.js'\r\nimport TimeAgo from '../TimeAgo.js'\r\nimport { hour, minute, day, month, year } from '../steps/index.js'\r\n\r\ndescribe('style/twitter', () => {\r\n\tit('should fallback from \"mini\" to \"narrow\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('ccp')\r\n\t\ttimeAgo.format(Date.now() - 3 * hour * 1000, 'twitter').should.include(' ๐๐ฎ๐๐ด๐ ๐๐๐ฌ')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(-secondsPassed * 1000, { now: 0, ...twitter })\r\n\r\n\t\tformatDatePastBy(0.49).should.equal('0s')\r\n\t\tformatDatePastBy(0.5).should.equal('1s')\r\n\t\tformatDatePastBy(59.49).should.equal('59s')\r\n\t\tformatDatePastBy(59.5).should.equal('1m')\r\n\t\tformatDatePastBy(1.49 * minute).should.equal('1m')\r\n\t\tformatDatePastBy(1.5 * minute).should.equal('2m')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(59.49 * minute).should.equal('59m')\r\n\t\tformatDatePastBy(59.5 * minute).should.equal('1h')\r\n\t\tformatDatePastBy(1.49 * hour).should.equal('1h')\r\n\t\tformatDatePastBy(1.5 * hour).should.equal('2h')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(23.49 * hour).should.equal('23h')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(-secondsPassed * 1000, { now: 0, ...twitter, round: 'floor' })\r\n\r\n\t\tformatDatePastBy(0).should.equal('0s')\r\n\t\tformatDatePastBy(0.9).should.equal('0s')\r\n\t\tformatDatePastBy(1).should.equal('1s')\r\n\t\tformatDatePastBy(59.9).should.equal('59s')\r\n\t\tformatDatePastBy(60).should.equal('1m')\r\n\t\tformatDatePastBy(1.9 * minute).should.equal('1m')\r\n\t\tformatDatePastBy(2 * minute).should.equal('2m')\r\n\t\tformatDatePastBy(2.9 * minute).should.equal('2m')\r\n\t\tformatDatePastBy(3 * minute).should.equal('3m')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(59.9 * minute).should.equal('59m')\r\n\t\tformatDatePastBy(60 * minute).should.equal('1h')\r\n\t\tformatDatePastBy(1.9 * hour).should.equal('1h')\r\n\t\tformatDatePastBy(2 * hour).should.equal('2h')\r\n\t\tformatDatePastBy(2.9 * hour).should.equal('2h')\r\n\t\tformatDatePastBy(3 * hour).should.equal('3h')\r\n\t\t// โฆ\r\n\t\tformatDatePastBy(23.9 * hour).should.equal('23h')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (English) (absolute dates)', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2016, 12:00.\r\n\t\tconst now = new Date(2016, 3, 10, 12, 0).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(day + 2 * minute + hour).should.equal('Apr 9')\r\n\t\t// โฆ\r\n\t\t// `month` is about 30.5 days.\r\n\t\tformatDatePastBy(month * 3).should.equal('Jan 10')\r\n\t\tformatDatePastBy(month * 4).should.equal('Dec 10, 2015')\r\n\t\tformatDatePastBy(year).should.equal('Apr 11, 2015')\r\n\r\n\t\t// Test future dates.\r\n\t\t// `month` is about 30.5 days.\r\n\t\tformatDatePastBy(-1 * month * 8).should.equal('Dec 10')\r\n\t\tformatDatePastBy(-1 * month * 9).should.equal('Jan 9, 2017')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Russian)', () => {\r\n\t\tconst timeAgo = new TimeAgo('ru')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(0).should.equal('0 ั')\r\n\t\tformatDatePastBy(1).should.equal('1 ั')\r\n\t\tformatDatePastBy(minute).should.equal('1 ะผะธะฝ')\r\n\t\tformatDatePastBy(hour).should.equal('1 ั')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9 ะฐะฟั.')\r\n\t\tformatDatePastBy(year).should.equal('11 ะฐะฟั. 2015 ะณ.')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Korean)', () => {\r\n\t\tconst timeAgo = new TimeAgo('ko')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1๋ถ')\r\n\t\tformatDatePastBy(hour).should.equal('1์๊ฐ')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('4์ 9์ผ')\r\n\t\tformatDatePastBy(year).should.equal('2015๋
4์ 11์ผ')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (German)', () => {\r\n\t\tconst timeAgo = new TimeAgo('de')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1 Min.')\r\n\t\tformatDatePastBy(hour).should.equal('1 Std.')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9. Apr.')\r\n\t\tformatDatePastBy(year).should.equal('11. Apr. 2015')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (French)', () => {\r\n\t\tconst timeAgo = new TimeAgo('fr')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1 min.')\r\n\t\tformatDatePastBy(hour).should.equal('1 h')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('9 avr.')\r\n\t\tformatDatePastBy(year).should.equal('11 avr. 2015')\r\n\t})\r\n\r\n\tit('should format Twitter style relative time (Chinese)', () => {\r\n\t\tconst timeAgo = new TimeAgo('zh')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatDatePastBy = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...twitter })\r\n\r\n\t\tformatDatePastBy(minute).should.equal('1ๅ้')\r\n\t\tformatDatePastBy(hour).should.equal('1ๅฐๆถ')\r\n\t\tformatDatePastBy(day + 62 * minute).should.equal('4ๆ9ๆฅ')\r\n\t\tformatDatePastBy(year).should.equal('2015ๅนด4ๆ11ๆฅ')\r\n\t})\r\n\r\n\t// This test won't pass because `Intl.DateTimeFormat` is read at\r\n\t// initialization time, not at run time.\r\n\t// it('should fall back to generic style when Intl.DateTimeFormat is not available', () => {\r\n\t// \tconst DateTimeFormat = Intl.DateTimeFormat\r\n\t// \tIntl.DateTimeFormat = undefined\r\n\t//\r\n\t// \tconst timeAgo = new TimeAgo('en')\r\n\t// \ttimeAgo.format(Date.now() - 365 * 24 * hour * 1000, 'twitter').should.equal('1yr')\r\n\t//\r\n\t// \tIntl.DateTimeFormat = DateTimeFormat\r\n\t// })\r\n\r\n\tit('should support timestamp argument on `yearMonthAndDay.test()`', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\ttimeAgo.format(0, 'twitter').should.equal('Jan 1, 1970')\r\n\t})\r\n\r\n\tit('should round as \"floor\"', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\t\tconst test = (time, result) => timeAgo.format(time, 'twitter', {\r\n\t\t\tround: 'floor',\r\n\t\t\tnow: 0\r\n\t\t}).should.equal(result)\r\n\t\ttest(2001, '2s')\r\n\t\ttest(2000, '2s')\r\n\t\ttest(1999, '1s')\r\n\t\ttest(1001, '1s')\r\n\t\ttest(1000, '1s')\r\n\t\ttest(999, '0s')\r\n\t\ttest(0, '0s')\r\n\t\ttest(-999, '0s')\r\n\t\ttest(-1000, '1s')\r\n\t\ttest(-1001, '1s')\r\n\t\ttest(-1999, '1s')\r\n\t\ttest(-2000, '2s')\r\n\t\ttest(-2001, '2s')\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2018, 12:00.\r\n\t\tconst date = new Date(2018, 3, 10, 12, 0)\r\n\r\n\t\t// April 10th, 2016, 12:00 (two years earlier).\r\n\t\tlet now = new Date(2016, 3, 10, 12, 0).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tgetTimeToNextUpdateUncapped: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10, 2018',\r\n\t\t\t// Updates on Jan 1st, 2018, 00:00.\r\n\t\t\tnew Date(2018, 0, 1).getTime() - now\r\n\t\t])\r\n\r\n\t\t// 1st, 2018, 00:00.\r\n\t\tnow = new Date(2018, 0, 1).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tgetTimeToNextUpdateUncapped: true,\r\n\t\t\t\tround: 'floor'\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10',\r\n\t\t\t// Updates after April 9th, 2018, 12:00.\r\n\t\t\t(new Date(2018, 3, 9, 12, 0).getTime() + 1) - now\r\n\t\t])\r\n\r\n\t\t// After April 9th, 2018, 12:00.\r\n\t\tnow = new Date(2018, 3, 9, 12, 0).getTime() + 1\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tround: 'floor'\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'23h',\r\n\t\t\t// Updates in an hour.\r\n\t\t\t60 * 60 * 1000\r\n\t\t])\r\n\t})\r\n\r\n\tit('should get time to next update (round: \"round\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\t// April 10th, 2018, 12:00.\r\n\t\tconst date = new Date(2018, 3, 10, 12, 0)\r\n\r\n\t\tlet now\r\n\r\n\t\t// 1st, 2018, 00:00.\r\n\t\tnow = new Date(2018, 0, 1).getTime()\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true,\r\n\t\t\t\tgetTimeToNextUpdateUncapped: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'Apr 10',\r\n\t\t\t// Updates after April 9th, 2018, 11:30.\r\n\t\t\t(new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1) - now\r\n\t\t])\r\n\r\n\t\t// After April 9th, 2018, 12:00.\r\n\t\tnow = new Date(2018, 3, 9, 12, 0).getTime() + 30 * 60 * 1000 + 1\r\n\r\n\t\ttimeAgo.format(\r\n\t\t\tdate,\r\n\t\t\t'twitter',\r\n\t\t\t{\r\n\t\t\t\tnow,\r\n\t\t\t\tgetTimeToNextUpdate: true\r\n\t\t\t}\r\n\t\t).should.deep.equal([\r\n\t\t\t'23h',\r\n\t\t\t// Updates in an hour.\r\n\t\t\t60 * 60 * 1000\r\n\t\t])\r\n\t})\r\n})"],"mappings":";;;;;;AAAA,OAAOA,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,CACD,CAAC,CAACZ,MAAM,CAACc,IAAI,CAACT,KAAK,CAAC,CACnB,KAAK;IACL;IACA,EAAE,GAAG,EAAE,GAAG,IAAI,CACd,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
function _objectSpread(
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { minute } from '../steps/units.js';
|
|
8
8
|
import twitter from './twitter.js';
|
|
9
9
|
export default _objectSpread(_objectSpread({}, twitter), {}, {
|
|
10
10
|
// Skip "seconds".
|
|
11
11
|
steps: twitter.steps.filter(function (step) {
|
|
12
12
|
return step.formatAs !== 'second';
|
|
13
|
-
})
|
|
13
|
+
})
|
|
14
|
+
// Start showing `1m` from the first minute.
|
|
14
15
|
.map(function (step) {
|
|
15
16
|
return step.formatAs === 'minute' ? _objectSpread(_objectSpread({}, step), {}, {
|
|
16
17
|
minTime: minute
|