1.0.0 • Published 3 years ago

@alta-ng-timeago/hiamtanh-alta v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

persian-time-ago-pipe

Build Status npm npm GitHub issues npm

A really simple, lightweight Angular pipe for converting a date string into a time ago

version

angular 5+

"now working with ivy and Angualr 9+ no problem :)"

Time RangeOutput
0 - 45 secondsچند ثانیه پیش
45 - 90 secondsدقیقه ای پیش
90 seconds - 45 minutesX دقیقه پیش
45 - 90 minutesساعتی پیش
90 minutes - 22 hoursX ساعت پیش
22 - 36 hoursروزی پیش
36 hours - 25 daysX روز پیش
25 - 45 daysیک ماه پیش
45 - 345 daysX ماه پیش
345 - 545 days (1.5 years)یک سال پیش
546 days+X سال پیش

Installation

npm install persian-time-ago-pipe --save

Usage

It can be imported into your angular project, as you would for any other library.

In the @NgModule you want to use it in

import { PersianTimeAgoModule } from 'persian-time-ago-pipe';

add "PersianTimeAgoPipe" to your declarations

@NgModule({
	imports: [... ,PersianTimeAgoModule , ...]
})

In your component templates you can just do:

<span>{{your_date | persianTimeAgo}}</span>

where "your_date" is a local date as a "string", which could be parsed by the standard Js Date()

//in component
_dt = new Date();
//in html
<span>{{_dt.toString() | persianTimeAgo}}</span>

If this value is null or not parsable as a date, then the pipe will display nothing

ababacornadm-zipafteragent-baseaggregate-errorajv-errorsajv-keywordsalphanum-sortansi-colorsansi-htmlansi-regexansi-stylesapp-root-pathaprobaargaria-queryarity-narr-diffarr-flattenarr-unionarray-flattenarray-unionarray-uniqarray-uniquearraybuffer.slicearrifyasapassert-plusassign-symbolsast-types-flowasyncasync-eachasync-limiterasynckitat-least-nodeatobaws-sign2aws4axobject-querybacko2balanced-matchbase64-arraybufferbase64-jsbase64idbatchbetter-assertbig.jsbinary-extensionsblobbluebirdbn.jsboolbasebrorandbrace-expansionbufferbuffer-frombuffer-indexofbuffer-xorbuiltin-modulesbuiltin-status-codesbuiltinsbytescall-bindcaller-callsitecaller-pathcallsitescallsitecamelcasecaniuse-litecanonical-pathcaselesschardetchownrchrome-trace-eventcircular-dependency-pluginclean-stackcli-spinnerscli-widthclonecolor-convertcolor-namecolorettecolorscombined-streamcommandercommondircomponent-bindcomponent-emittercomponent-inheritcompose-functionconcat-mapconnect-history-api-fallbackconsole-browserifyconstants-browserifycontent-typecookiecookie-signaturecopy-descriptorcore-jscore-util-iscss-color-namescss-select-base-adaptercss-selector-tokenizercss-treecss-whatcssesccssnano-util-get-argumentscssnano-util-get-matchcssnano-util-same-parentcssocuintcustom-eventcyclistdamerau-levenshteindashdashdate-formatdebuglogdecamelizedecode-uri-componentdeepmergedefaultsdefine-propertydelayed-streamdepddependency-graphdestroydetect-nodedidiffdns-equaldns-txtdom-serializerdomain-browserdomelementtypedomutilsdot-propee-firstelectron-to-chromiumemoji-regexemojis-listencodeurlengine.io-parserententitieserr-codeerror-exes-to-primitivees6-promisees6-promisifyescaladeescape-htmlescape-string-regexpeslint-scopeesprimaesrecurseestraverseestree-walkeresutilsetageventemitter3eventsexitextendextextend-shallowfast-deep-equalextsprintffast-json-stable-stringifyfastparsefiggy-puddingfiguresfind-parent-dirflattedfollow-redirectsforever-agentfor-inforwardedfragment-cachefreshfs.realpathfseventsfunction-bindgenfungensyncget-caller-fileget-intrinsicget-valuegetpassglob-parentglobalsgraceful-fshandle-thinghar-schemahashas-ansihas-binary2has-corshas-flaghas-symbolshas-valuehas-valueshex-color-regexhsl-regexhsla-regexhtml-entitieshtml-escaperhtml-comment-regexhttp-cache-semanticshttp-deceiverhttp-proxy-agenthttps-browserifyieee754iferrimage-sizeignoreimmediateimurmurhashindent-stringindexes-ofindexofinfer-ownerinheritsiniipinvariantipaddr.jsip-regexis-accessor-descriptoris-absolute-urlis-argumentsis-arrayishis-bufferis-binary-pathis-core-moduleis-callableis-date-objectis-data-descriptoris-descriptoris-dockeris-directoryis-extendableis-extglobis-fullwidth-code-pointis-globis-interactiveis-moduleis-negative-zerois-numberis-objis-path-cwdis-plain-objis-plain-objectis-referenceis-regexis-resolvableis-streamis-svgis-symbolis-typedarrayis-windowsis-wslisarrayisbinaryfileisexeisobjectisstreamistanbul-lib-coverageistanbul-lib-reportistanbul-reportsjasmine-corejest-workerjasminewd2jsbnjs-tokensjsescjson-parse-better-errorsjson-parse-even-better-errorsjson-schemajson-stringify-safejson-schema-traversejsonc-parserjson3jsonfilejsonparsekillablekind-ofklonalevenlielevenaryloader-runnerlines-and-columnslodash.clonedeeplodashlodash.memoizelodash.sortbylodash.uniqmake-errorloglevelmap-cachemdn-datamedia-typerloose-envifymerge-source-mapmerge-descriptorsmerge-streammerge2methodsmiller-rabinmimelog-symbols
1.0.0

3 years ago