export const DE = Object.freeze({
|
weekDays: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
|
months: [undefined,
|
"Januar", "Februar", "März", "April",
|
"Mai", "Juni", "Juli", "August",
|
"September", "Oktober", "November", "Dezember"],
|
firstDayOfWeek: 1
|
});
|
|
export const EN = Object.freeze({
|
weekDays : ["Sun", "Mon", "Tue", "Wen", "Thu", "Fri", "Sat"],
|
months: [undefined,
|
"January", "February", "March", "April",
|
"May", "June", "July", "August",
|
"September", "October", "November", "December"
|
],
|
firstDayOfWeek: 0
|
});
|
|
export const FR = Object.freeze({
|
weekDays : ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
|
months: [undefined,
|
"janvier", "février", "mars", "avril",
|
"mai", "juin", "juillet", "août",
|
"septembre", "octobre", "novembre", "décembre"
|
],
|
firstDayOfWeek: 1
|
});
|
|
/* Student exercises begin from here */
|
/**
|
* parsers a string, which represents a month in numeral writing, to a number of
|
* month, between 1 (january) and 12 (december), or is a name of a month
|
* accorded the given language.
|
*
|
* @param {string|number} month
|
* @param {string} language optional case-insensitive Language Code. If a
|
* language is not available, then use default language which is EN. (In this case
|
* if the input in given language not the same as english word --mostly the case--
|
* then it is not recognized.)
|
*
|
* @return {number} month, which is represented in string.
|
*
|
* @throws {RangeError} if not a valid month
|
*
|
* */
|
export function parseMonth(month, language="EN") {
|
// TODO: Exercise: implement this function as the specification in comment!
|
// if the implementation is correct, the unit tests will be passed.
|
return Number.parseInt(month);
|
}
|
|
|
/**
|
* parses a string, which represents a year in Gregorian Calendar, to a year in
|
* data type number.
|
*
|
* @param {string} year
|
*
|
* @return {number} year
|
* @throws {RangeError} if the year is not a valid year number in Gregorian Calendar.
|
* */
|
export function parseYear(year) {
|
// TODO: Exercise: implement this function as the specification in comment!
|
return Number.parseInt(year);
|
}
|