{"id":40807,"library":"dateable","title":"dateable","description":"A lightweight date formatting and parsing library for Node.js, version 1.0.1. It provides functions to format dates using custom patterns, parse formatted strings back to Date objects, compute relative time (e.g., '4 years ago'), and calculate differences between dates. It supports localized output via language configuration. The API is minimal and synchronous, distinguishing it from heavier libraries like Moment.js. The project appears to be in maintenance mode with no recent updates.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/eivindfjeldstad/dateable","tags":["javascript","date","dates","parser","parsing","format","formatter"],"install":[{"cmd":"npm install dateable","lang":"bash","label":"npm"},{"cmd":"yarn add dateable","lang":"bash","label":"yarn"},{"cmd":"pnpm add dateable","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is ESM-compatible? Actually, the README shows 'var dateable = require('dateable')' indicating CommonJS. Default import works as a function.","wrong":"const dateable = require('dateable')","symbol":"dateable","correct":"import dateable from 'dateable'"},{"note":"parse is a method on the default export, not a named export.","wrong":"import { parse } from 'dateable'","symbol":"dateable.parse","correct":"import dateable from 'dateable'; dateable.parse(str, format)"},{"note":"when is a method on the default export.","wrong":"import { when } from 'dateable'","symbol":"dateable.when","correct":"import dateable from 'dateable'; dateable.when(date)"}],"quickstart":{"code":"import dateable from 'dateable';\n\nconst date = new Date(2009, 4, 23);\n\n// Format a date\nconst formatted = dateable(date, 'MM/DD-YYYY, hh:mm');\nconsole.log(formatted); // => \"05/23-2009, 00:00\" (depends on timezone)\n\n// Parse a formatted string\nconst parsed = dateable.parse('05/23-2009, 00:00', 'MM/DD-YYYY, hh:mm');\nconsole.log(parsed); // => Sat May 23 2009 00:00:00 GMT+0000 (UTC)\n\n// Relative time\nconst past = new Date(2008, 4, 20);\nconsole.log(dateable.when(past)); // => \"4 years ago\" (depending on current date)\n\n// Difference between two dates\nconst start = new Date(2015, 0, 1);\nconst end = new Date();\nconsole.log(dateable.diff(start, end)); // => \"9 years\" (at time of writing)","lang":"javascript","description":"Demonstrates core functions: format, parse, relative time, and difference between dates."},"warnings":[{"fix":"Use UTC-oriented methods or ensure consistent time zone handling in your application.","message":"Time zone differences: The library outputs date parts based on local time zone of the runtime, not UTC. Formatting 'hh:mm' may shift by offset.","severity":"gotcha","affected_versions":"<=1.0.1"},{"fix":"Consider switching to maintained alternatives like date-fns or dayjs.","message":"No maintenance since 2014; the library is not updated for modern JavaScript environments.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Wrap literal text in quotes: dateable(date, \"'Today is' dddd\")","message":"Escape text in format requires quotes: Use single or double quotes around literal text in the format string, otherwise it will be treated as format tokens.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set language before formatting calls, or use separate instances if available (not supported).","message":"Language method overrides global locale; affects all subsequent calls.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':12 '4':33 'ago':35 'api':49 'appear':63 'back':25 'calcul':37 'comput':29 'configur':47 'custom':20 'date':4,18,27,40,74,75 'dateabl':1 'differ':38 'distinguish':54 'e.g':32 'format':5,17,23,78 'formatt':79 'function':15 'heavier':57 'javascript':73 'languag':46 'librari':8,58 'lightweight':3 'like':59 'local':43 'mainten':67 'minim':51 'mode':68 'moment.js':60 'node.js':10 'object':28 'output':44 'pars':7,22,77 'parser':76 'pattern':21 'project':62 'provid':14 'recent':71 'relat':30 'string':24 'support':42 'synchron':53 'time':31 'updat':72 'use':19 'version':11 'via':45 'year':34","created_at":"2026-06-04T18:49:21.401362+00:00","updated_at":"2026-06-04T18:49:21.401362+00:00","problems":[{"fix":"Use `import dateable from 'dateable'` (or `const dateable = require('dateable')` in CommonJS).","cause":"Importing incorrectly: { dateable } instead of default import.","error":"dateable is not a function"},{"fix":"Call `dateable.when(date)` after default import.","cause":"Attempting to import `when` as a named export.","error":"TypeError: dateable.when is not a function"},{"fix":"Install package: `npm install dateable` and import correctly.","cause":"Missing import or incorrect module path.","error":"ReferenceError: dateable is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/eivindfjeldstad/dateable","github":"git://github.com/eivindfjeldstad/dateable","docs":null,"changelog":null,"pypi":null,"npm":"dateable","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}