
Security News
Google’s OSV Fix Just Added 500+ New Advisories — All Thanks to One Small Policy Change
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
@kev_nz/daylight
Advanced tools
note: daylight does a rather rudimentary job parsing dates (strings are just passed through Date.parse()
), so beware of local timezone vs utc time-string pitfalls.
TODO: requirejs, commonjs, etc. module support
<script src="daylight.js"></script>
<script>
var today = daylight('l, F jS', Date.now());
var p = document.createElement('p');
p.innerText = today;
document.body.appendChild(p);
//=> <p>Wednesday, May 28th</p>
</script>
install with npm install daylight
, run tests with npm test
, etc.
var daylight = require('daylight');
console.log(daylight('l, F jS', Date.now()));
//=> Wednesday, May 28th
these are copied from php's date()
function
characters not on this list are passed normally; to escape characters you'll have to use double backslashes:
var today = daylight('\\d\\a\\y: l', Date.now());
console.log(today);
//=> day: Wednesday
string | format | example |
---|---|---|
d | day of month, with leading zero | 01 to 31 |
D | day of week, three letter abbreviation | Sun to Sat |
j | day of month, without leading zero | 1 to 31 |
l (lower-case L) | day of week, full word | Sunday to Saturday |
N | numeric day of the week | 1 to 7 |
S | English suffix | st, nd, rd, th |
w | zero-based day of the week | 0 (Sunday) to 6 |
z | numeric day of the year | 1-366 |
F | month, full word | January to December |
m | month with leading zero | 1 to 12 |
M | month, three letter abbreviation | Jan to Dec |
n | month without leading zero | 1 to 12 |
Y | four-digit year | 1989 or 2014 |
y | two-digit year | 89 or 14 |
a | lowercase ante or post meridiem | am or pm |
A | uppercase ante or post meridiem | AM or PM |
g | 12-hour format, no leading zero | 1 to 12 |
G | 24-hour format, no leading zero | 0 to 23 |
h | 12-hour format, leading zero | 01 to 12 |
H | 24-hour format, leading zero | 00 to 23 |
i | minutes, with leading zero | 00 to 59 |
s | seconds, with leading zero | 00 to 59 |
FAQs
lightweight javascript date formatting
The npm package @kev_nz/daylight receives a total of 1,877 weekly downloads. As such, @kev_nz/daylight popularity was classified as popular.
We found that @kev_nz/daylight demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
Research
/Security News
175 malicious npm packages (26k+ downloads) used unpkg CDN to host redirect scripts for a credential-phishing campaign targeting 135+ organizations worldwide.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.