g | x | w | all
Bytes Lang Time Link
065Japt210701T133038ZShaggy
186Python 3210701T231017Zmovatica
132PHP210702T124947ZKaddath
155Perl 5210702T140620ZKjetil S
125Ruby210702T111808ZKateba
09205AB1E210701T132736ZKevin Cr
119JavaScript ES6210701T130734ZArnauld

Japt, 71 70 69 68 65 bytes

+3 bytes for the unnecessary requirement of uppercase output.

£ÐX eÃÍâ 
`³eêѳeks³ek»y`q¤ËuÃæ@eYg[[T6]7o 5õ]ê7Æ'_+ÐTTX)gUøXì

Try it (includes all test cases)

Outdated Explanation

£ÐX eÃÍâ\n`...`q¤ËuÃæÏg[60¥U¬Ô7¥UÊUe5õ]ê7Æ'_+ÐTTX)gUøXì     :Implicit input of date string array U
£                                                             :Map each X
 ÐX                                                           :  Convert to date object
    e                                                         :  Get 0-indexed weekday (0=Sunday)
     Ã                                                        :End map
      Í                                                       :Sort
       â                                                      :Deduplicate
        \n                                                    :Reassign to U
          `...`                                               :Compressed string "weekendsallweeksweekday"
               q                                              :Split on
                ¤                                             :  "s"
                 Ë                                            :Map
                  u                                           :  Uppercase
                   Ã                                          :End map
                    æ                                         :Get first element that returns true
                     Ï                                        :When its index is passed through the following function
                      g[              ]                       :  Index into array containing
                        60¥                                   :    0. Is 60 equal to
                           U¬                                 :       Join U
                             Ô                                :       Reverse
                              7¥                              :    1. Is 7 equal to
                                UÊ                            :       Length of U
                                  Ue                          :    2. Test U for equality with
                                    5õ                        :       Range [1,5]
                                       Ã                      :End filter
                                        ª                     :Logical OR with
                                         7Æ                   :  Map each X in the range [0,7)
                                           '_                 :    Literal "_"
                                             +                :    Append (coercing the following to a string)
                                              Ð               :      Create a date object with
                                               T              :        Year 0,
                                                T             :        Month 0, and
                                                 X            :        Date X
                                                  )           :    End append
                                                   g          :    Get character at index
                                                    UøE       :      Does U contain E?
                                                       Ã      :  End map
                                                        ¬     :  Join

Python 3, 223 216 204 200 190 186 bytes

Straight forward implementation with datetime functions, no fancy string compression.

Saved some bytes exploiting a dict for the special cases.

-4 bytes thanx to Kateba

from datetime import*
m='MTWTFSS'
def f(x,y='_'*7):
 for z in x:i=date.fromisoformat(z).weekday();y=y[:i]+m[i]+y[i+1:]
 return{y:y,m:'ALLWEEK','MTWTF__':'WEEKDAY','_____SS':'WEEKEND'}[y]

Try it online!

PHP, 133 132 bytes

for($w=SMTWTFS,$r=_______;$d=$argv[++$i];)$r[$j=$d->format(w)]=$w[$j];echo$r==$w?ALLWEEK:$r==_MTWTF_?WEEKDAY:$r==S_____S?WEEKEND:$r;

Try it online!

Uses the script arguments array converted to DateTime objects (1-indexed), uses the SMTWTFS format.

First version with the dict exploit like in movatica's answer, but still looking how to shorten it.

EDIT: saved 1 byte with ternary operators

Perl 5, 155 bytes

$o="_"x7;join("",map{strftime"%F%w%A",0,0,0,$_,0,0}0..6e4)=~/$_(.)(.)/,substr$o,$1,1,$2for@F;$_={_MTWTF_,WEEKDAY,S_____S,WEEKEND,SMTWTFS,ALLWEEK}->{$o}||$o

Try it online!

Ruby, 125 bytes

f=->l{i=0;l.map{|d|i|=2**d.wday};{i=>(0..6).map{|a|i[a]>0?'SMTWTFS'[a]:?_}*'',62=>'WEEKDAY',65=>"WEEKEND",127=>"ALLWEEK"}[i]}

Try it online!

Takes a list of Dates and outputs in the SMTWTFS format. Abuses Ruby's integer subscriptions to get a (sort of) boolean array.

I copied the dict exploit of the python answer, it works well :)

05AB1E, 93 92 bytes

'_7×sε`UD3‹©12*+>₂*T÷®Xα©т%D4÷®т÷©4÷®·(O7%}D.•1Î㦕©sèsǝÀÐáÐÙ'sQi'œÙ뮦¦Qi’…Â‚Ž’ëQi’€Ÿ…Â’]u

Inputs in the format [dd,mm,yyyy]; output format starts at Sunday (SMTWTFS).

Try it online or verify all test cases.

Explanation:

Since 05AB1E has no Date builtins, we'll have to calculate the Day of the Week manually.

The general formula to do this is:

$${\displaystyle h=\left(q+\left\lfloor{\frac{13(m+1)}{5}}\right\rfloor+K+\left\lfloor{\frac{K}{4}}\right\rfloor+\left\lfloor{\frac{J}{4}}\right\rfloor-2J\right){\bmod{7}}}$$

Where for the months March through December:

And for the months January and February:

Resulting in the day of the week \$h\$, where 0 = Saturday, 1 = Sunday, ..., 6 = Friday.
Source: Zeller's congruence

The implementation of this formula in the code below is:

`UD3‹©12*+>₂*T÷®Xα©т%D4÷®т÷©4÷®·(O7%
'_7×        '# Push string "_______"
s            # Swap to get the (implicit) input-list
 ε           # Map over each date:
             #  Determine its day of the week:
  `          #   Push the day, month, and year to the stack
   U         #   Pop and save the year in variable `X`
    D        #   Duplicate the month
     3‹      #   Check if the month is below 3 (Jan. / Feb.),
             #   resulting in 1 or 0 for truthy/falsey respectively
       ©     #   Store this in variable `®` (without popping)
        12*  #   Multiply it by 12 (either 0 or 12)
           + #   And add it to the month
             #   (This first part was to make Jan. / Feb. 13 and 14)
  >          #   Month + 1
   ₂*        #   Multiplied by 26
     T÷      #   Integer-divided by 10
  ®          #   Push month<3 from variable `®` again
   Xα        #   Take the absolute difference with the year
     ©       #   Store this potentially modified year as new `®` (without popping)
      т%     #   mYear modulo-100
  D4÷        #   mYear modulo-100, integer-divided by 4
  ®т÷©4÷     #   mYear integer-divided by 100, and then integer-divided by 4
  ®·(        #   mYear integer-divided by 100, doubled, and then made negative
  O          #   Take the sum of all values on the stack
   7%        #   And then take modulo-7 to complete the formula, resulting in 0 for
             #   Saturday, 1 for Sunday, and [2, 6] for [Monday, Friday]
}D           # After the map: duplicate the list of integers
  .•1Î㦕   # Push compressed string "ssmtwtf"
          ©  # Store it in variable `®` (without popping)
  s          # Swap so the duplicated list of integers is at the top
   è         # Index each into this string
    s        # Swap so the list of integers is at the top again
     ǝ       # Insert the characters at these indices inside the "_______" string
      À      # Rotate it once towards the left
Ð            # Triplicate this result
 á           # Only leave the letters of the top copy
  Ð          # Triplicate that as well
   „ssQi    '# Pop one copy, and if it's equal to "ss":
      'œÙ   '#  Push dictionary string "weekend"
    뮦¦Qi   # Else-if it's equal to `®` minus its first two characters ("mtwtf"):
      ’…Â‚Ž’ #  Push dictionary string "weekday"
    ëQi      # Else-if the string remained the same after only leaving letters:
      ’€Ÿ…Â’ #  Push dictionary string "allweek"
    ]        # Close all if-else statements
     u       # Uppercase the result
             # (after which this is output implicitly)

See this 05AB1E tip of mine (sections How to use the dictionary? and How to compress strings not part of the dictionary?) to understand why .•1Î㦕 is "ssmtwtf"; 'œÙ is "weekend"; ’…Â‚Ž’ is "weekday"; and ’€Ÿ…Â’ is "allweek".

JavaScript (ES6), 119 bytes

Expects a list of Date objects. Uses the SMTWTFS format.

a=>a.map(d=>a|=1<<d.getDay())|a-127?a-62?a-65?'SMTWTFS'.replace(/./g,(c,i)=>a>>i&1?c:'_'):'WEEKEND':'WEEKDAY':'ALLWEEK'

Try it online!