![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
daylight
Advanced tools
Readme
I absolutely love the moment.js library, but at times it runs a bit heavier than I really need. I like the simplicity of PHP's built-in date()
function and wrote this to be sort of similar.
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 daylight receives a total of 16 weekly downloads. As such, daylight popularity was classified as not popular.
We found that 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.