moment

An Alfred Workflow


Short Description

Advanced time utility.

Last Updated

24 Feb 2016

Compatibility

Yosemite
(10.10)
Mavericks
(10.9)
Mountain Lion
(10.8)
Lion
(10.7)
Snow Leopard
(10.6)
Yes Yes Yes Yes Yes
 

Version

1.1
 

Bundle ID

com.lostjs.moment
 

alfred-workflow-moment

Advanced time utility for alfred 2 workflow. Inspired by moment.js and [alfred-datetime-format-converter].

DOWNLOAD LINK

command

now

Get current timestamp and formatted time.

moment [arg]...

Calculate timestamp by arguments. There is servals calculate command:

<timestamp>:

Init/reset time. both UNIX timestamp and timestamp with milliseconds are supported. For example: moment 1455624282913 or moment 1455624282.

moment 1455624282913

<operator> <attribute>

Shift time. operator is like +1, -100. attribute is like year, month, day. For example: moment +1 day.

moment +1 day

set <attribute> <number>

Replace specified attribute. For example: moment set hour 4

moment set hour 4

start of <attribute>

Get start of the time span which split by specified attribute. For example moment start of year.

moment start of year

end of <attribute>

Get end of the time span which split by specified attribute. For example moment end of year.

moment end of year

format <format string>

Format time by specified format. The format token table For example moment format MMMM DD, YYYY.

moment format MMMM DD, YYYY

Combine command

Combination of commands is acceptable. For example: moment 1455626556616 start of minute set hour 4 set day 1 end of minute.

combination of commands

Please note that the format command will all rest arguments as format string, so format command should always be the last command.

supported time attributes

attribute alias
year y
month M
day d
hour h
minute m
second s

supported format token

Because python library arrow is chosen to deal with time, you can use the following tokens for formatting and parseing time:

Token Output
Year YYYY 2000, 2001, 2002 ... 2012, 2013
YY 00, 01, 02 ... 12, 13
Month MMMM January, February, March ...
MMM Jan, Feb, Mar ...
MM 01, 02, 03 ... 11, 12
M 1, 2, 3 ... 11, 12
Day of Year DDDD 001, 002, 003 ... 364, 365
DDD 1, 2, 3 ... 4, 5
Day of Month DD 01, 02, 03 ... 30, 31
D 1, 2, 3 ... 30, 31
Do 1st, 2nd, 3rd ... 30th, 31st
Day of Week dddd Monday, Tuesday, Wednesday ...
ddd Mon, Tue, Wed ...
d 1, 2, 3 ... 6, 7
Hour HH 00, 01, 02 ... 23, 24
H 0, 1, 2 ... 23, 24
hh 01, 02, 03 ... 11, 12
h 1, 2, 3 ... 11, 12
AM / PM A AM, PM, am, pm
a am, pm
Minute mm 00, 01, 02 ... 58, 59
m 0, 1, 2 ... 58, 59
Second ss 00, 01, 02 ... 58, 59
s 0, 1, 2 ... 58, 59
SS 00, 01, 02 ... 98, 99
S 0, 1, 2 ... 8, 9
Timezone ZZZ Asia/Baku, Europe/Warsaw, GMT ...
Timestamp X 1381685817

Planned features

  • Save custom format by alfred setting storage
  • Time string parsing

Please be free to propose feature by create github issue.

License

MIT

Screenshots