{"id":26076810,"url":"https://github.com/purescript-contrib/purescript-formatters","last_synced_at":"2026-03-11T05:02:50.574Z","repository":{"id":41821305,"uuid":"63611916","full_name":"purescript-contrib/purescript-formatters","owner":"purescript-contrib","description":"Formatting and printing for numeric and date/time/interval values","archived":false,"fork":false,"pushed_at":"2023-04-08T16:36:38.000Z","size":155,"stargazers_count":40,"open_issues_count":19,"forks_count":29,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-01-12T14:36:07.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purescript-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-18T14:54:17.000Z","updated_at":"2024-12-21T20:39:28.000Z","dependencies_parsed_at":"2024-06-19T05:23:08.421Z","dependency_job_id":"fd62a34e-f1c4-468d-817e-02d76ae23285","html_url":"https://github.com/purescript-contrib/purescript-formatters","commit_stats":null,"previous_names":["slamdata/purescript-formatters"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/purescript-contrib/purescript-formatters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-formatters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-formatters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-formatters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-formatters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript-contrib","download_url":"https://codeload.github.com/purescript-contrib/purescript-formatters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-formatters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30372126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-03-09T02:35:44.221Z","updated_at":"2026-03-11T05:02:45.564Z","avatar_url":"https://github.com/purescript-contrib.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Formatters\n\n[![CI](https://github.com/purescript-contrib/purescript-formatters/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-formatters/actions?query=workflow%3ACI+branch%3Amain)\n[![Release](https://img.shields.io/github/release/purescript-contrib/purescript-formatters.svg)](https://github.com/purescript-contrib/purescript-formatters/releases)\n[![Pursuit](https://pursuit.purescript.org/packages/purescript-formatters/badge)](https://pursuit.purescript.org/packages/purescript-formatters)\n[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-teal.svg)](https://github.com/garyb)\n\nA PureScript alternative to numeral.js, moment.js, etc.\n\n## Installation\n\nInstall `formatters` with [Spago](https://github.com/purescript/spago):\n\n```sh\nspago install formatters\n```\n\n## Quick start\n\n**Number formatters**\n\nFormatter has following properties\n+ Number of digits before dot\n+ Number of digits after dot\n+ Should sign be printed for positive numbers\n+ Should thousands be separated by comma\n+ Should output string have abbreviations (like `K` or `M`)\n+ What decimal-separator character should be used (default '.')\n+ What thousand-group-separator character should be used (default '+')\n\n**Note:** The parser will return a formatter with the default separator-characters - use `withSeparators` to override this after parsing.\n\nNumber will be padded with zeros to have at least this number of leading zeros. This doesn't restrict number to have more digits then leading zeros in format string.\n+ `0000.0` will show 4 digits: `12 → \"0012.0\"`, `1234 → \"1234.0\"`\n+ `00.0` will show only 2 digits : `12 → \"12.0\"`, `1234 → \"1234.0\"`\n\nNumber of digits after dot is set by number of trailing zeros (note the rounding)\n+ `0.000` will show 3 digits: `0.12345 → \"0.123\"`, `12.98765 → \"12.988\"`\n+ `0.0` will show only 1 digit: `0.12345 → \"0.1\"`, `12.98765 → \"13.0\"`\n\nIf number is lesser then zero `-` is always printed. Otherwise you could specify `+` in format string\n+ `+0`: `12.0 → \"+12\"`, `-34.8 → \"-35\"`\n+ `0`: `12.0 → \"12\"`, `-34.8 → \"-35\"`\n\nThousands separator is specified as `,0` please note that this `0` isn't counted as leading.\n+ `00,0`: `1234567890 → \"1,234,567,890.0\", `1 → \"1.0\"`\n\nFor abbreviation one could use `a` flag. In general it tries to find the closest power of thousand and\nthen use formatter to result of division of input number and that power.\n+ `0a`: `1234567 → \"1M\"`, `1 → \"1\"`\n\n**Date/Time formatters**\n\nThis is a subset of common format/parse strings currently supported.\n\n+ `YYYY`  - Full Year      (\"1999\")\n+ `YY`    - 2 digit year   (\"99\")\n+ `MMMM`  - Full Month     (\"January\")\n+ `MMM`   - Short Month    (\"Jan\")\n+ `DD`    - Padded Day     (\"02\")\n+ `D`     - Day of month   (\"2\")\n+ `X`     - Unix Timestamp (\"1506875681\")\n+ `E`     - Day of Week    (\"2\")\n+ `dddd`  - DOW Name       (\"Monday\")\n+ `ddd`   - DOW Name Short (\"Mon\")\n+ `HH`    - 24 Hour        (\"13\")\n+ `hh`    - 12 Hour        (\"1\")\n+ `a`     - Meridiem       (\"am\"/\"pm\")\n+ `mm`    - Minutes Padded (\"02\")\n+ `m`     - Minutes        (\"2\")\n+ `ss`    - Seconds Padded (\"02\")\n+ `s`     - Seconds        (\"2\")\n+ `S`     - MilliSeconds   (\"4\")\n+ `SS`    - MilliSeconds   (\"04\")\n+ `SSS`   - MilliSeconds   (\"004\")\n+ `: -`   - Placeholder    (\": -\")\n+ `[ESC]` - Placeholder [escaped] (\"ESC\") \n\n\nFull list is defined [here](https://github.com/slamdata/purescript-formatters/blob/master/src/Data/Formatter/DateTime.purs)\n\n## Documentation\n\n`formatters` documentation is stored in a few places:\n\n1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-formatters).\n2. Written documentation is kept in the [docs directory](./docs).\n3. Usage examples can be found in [the test suite](./test).\n\nIf you get stuck, there are several ways to get help:\n\n- [Open an issue](https://github.com/purescript-contrib/purescript-formatters/issues) if you have encountered a bug or problem.\n- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://purescript.org/chat) chat.\n\n## Contributing\n\nYou can contribute to `formatters` in several ways:\n\n1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-contrib/purescript-formatters/issues). We'll do our best to work with you to resolve or answer it.\n\n2. If you would like to contribute code, tests, or documentation, please [read the contributor guide](./CONTRIBUTING.md). It's a short, helpful introduction to contributing to this library, including development instructions.\n\n3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the [PureScript Discourse](https://discourse.purescript.org)! Writing libraries and learning resources are a great way to help this library succeed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-contrib%2Fpurescript-formatters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript-contrib%2Fpurescript-formatters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-contrib%2Fpurescript-formatters/lists"}