{"id":25470112,"url":"https://github.com/thinkphp/prettydate","last_synced_at":"2025-11-04T18:30:28.993Z","repository":{"id":1496372,"uuid":"1748645","full_name":"thinkphp/prettydate","owner":"thinkphp","description":"This plugin MooTools provides a way to format JavaScript dates in the style of Twitter's timeline.","archived":false,"fork":false,"pushed_at":"2011-05-15T06:57:01.000Z","size":130,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T14:54:28.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://thinkphp.github.com/prettydate/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-14T19:02:37.000Z","updated_at":"2014-05-01T09:05:52.000Z","dependencies_parsed_at":"2022-08-16T13:25:19.891Z","dependency_job_id":null,"html_url":"https://github.com/thinkphp/prettydate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fprettydate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fprettydate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fprettydate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fprettydate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/prettydate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239437179,"owners_count":19638444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-18T08:31:57.528Z","updated_at":"2025-11-04T18:30:28.944Z","avatar_url":"https://github.com/thinkphp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"PrettyDate\n==========\n\nThis plugin provides a way to format JavaScript dates in the style of Twitter's timeline: \n\"just now\", \"about 8 minutes ago\",\"about 11 hours ago\",\"yesterday\". \nThe method is, originally, written by [John Resig](http://ejohn.org/blog/javascript-pretty-date/).\n\n![Screenshot](http://farm4.static.flickr.com/3229/5721430624_80ab38a116.jpg)\n\nHow to use\n----------\n\nFirst you must to include the JS files in the head of your HTML document.\n\n        #HTML\n        \u003cscript src=\"http://www.google.com/jsapi?key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q\"\u003e\u003c/script\u003e\n        \u003cscript type=\"text/javascript\"\u003egoogle.load(\"mootools\", \"1.3\");\u003c/script\u003e\n        \u003cscript type=\"text/javascript\" src=\"prettydate.js\"\u003e\u003c/script\u003e\n\n\nYou need to specify the source of the ISO8601-date.\n\n       #HTML\n       \u003cul\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003ejohn\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-14 20:35:28\"\u003eSun May 14 20:35:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003ecode\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-14 19:15:28\"\u003eSun May 14 19:15:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003ephp\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-14 10:54:28\"\u003eSun May 14  10:54:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003emootools\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-14 21:40:28\"\u003eSun May 14 21:40:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003ejquery\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-13 12:54:28\"\u003eSun May 14 12:54:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003cli\u003e@\u003ca href=\"#\"\u003eyui\u003c/a\u003e just happened here \u003cspan\u003e\u003cbr/\u003e\u003ci\u003eposted\u003c/i\u003e \u003ca class=\"pretty\" href=\"#\" title=\"2011-05-12 14:54:28\"\u003eSun May 14 19:54:28 +0000 2011\u003c/a\u003e\u003c/span\u003e\u003c/li\u003e\n       \u003c/ul\u003e\n\nThen you can apply the method.\n\n       #JS\n       window.addEvent('domready', function() {\n              new PrettyDate($$(\"a.pretty\"));\n       });\n\n       OR\n\n       //apply `prettyDate` method to those;\n       window.addEvent('domready', function() {\n              $$(\"a.pretty\").prettyDate(); \n       });       \n\n \nTo localize this plugin overwrite the options. \nex: french localization:\n\n       #JS \n       window.addEvent('domready', function() {\n            var options = {\n             now      : \"a l'instant\",\n             minute   : \"il y a 1 minute\",\n             minutes  : \"il y a {x} minutes\",\n             hour     : \"il y a 1 heure\",\n             hours    : \"il y a {x} heures\",\n             yesterday: \" hier\",\n             days     : \" il y a {x} jours\",\n             weeks    : \" il y a {x} semaines\"             \n            };\n            $$('a.pretty').prettyDate(options); \n       });\n         ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fprettydate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Fprettydate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fprettydate/lists"}