MCPcopy Create free account
hub / github.com/facebook/Rapid / localeDateString

Function localeDateString

modules/ui/note_comments.js:106–115  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

104
105
106 function localeDateString(s) {
107 if (!s) return null;
108 const options = { day: 'numeric', month: 'short', year: 'numeric' };
109 s = s.replace(/-/g, '/'); // fix browser-specific Date() issues
110 const d = new Date(s);
111 if (isNaN(d.getTime())) return null;
112
113 const localeCode = context.systems.l10n.localeCode();
114 return d.toLocaleDateString(localeCode, options);
115 }
116
117
118 render.note = function(val) {

Callers 1

renderFunction · 0.85

Calls 2

replaceMethod · 0.80
localeCodeMethod · 0.45

Tested by

no test coverage detected