1#compdef date
2
3local -a args
4
5if _pick_variant gnu="Free Software Foundation" unix --version; then
6  args=(
7    '-d[output specified date]:time string'
8    '-f[output dates specified in file]:file:_files'
9    '-I-[iso-8601]:precision:(date hours minutes seconds)'
10    '-r[reference]:file:_files'
11    '-R[rfc-2822]'
12    '-s[set]:time string'
13    '--rfc-3339=-[output date and time in RFC 3339 format]:output type:(date seconds ns)'
14    --
15    '*=FILE*:file:_files'
16    '*=DATEFILE*:date file:_files'
17  )
18else
19  case "$OSTYPE" in
20    solaris*)
21      args=( '-a:adjustment' )
22    ;;
23    freebsd*|darwin*)
24      args=(
25	'-n[only set time on current machine]'
26	'-d:daylight saving time value'
27	'-j[do not try to set date]'
28	'-f:parsing format'
29	'-r:seconds since epoch'
30	'-t:minutes west of GMT'
31	'-v:adjustment value'
32      )
33    ;;
34    openbsd*)
35      args=(
36	'-n[only set time on current machine]'
37	'-d:daylight saving time value'
38	'-a[gradually skew]'
39	'-r:seconds since epoch'
40	'-t:minutes west of GMT'
41      )
42    ;;
43  esac
44fi
45
46_arguments \
47  '-u[display or set time in UTC]' \
48  ': :_guard "^--*" "format or date"' \
49  "$args[@]"
50